[英]Scala Play Framework Discarding Cookies questions
嗨,我在使用Scala的Play框架中的“丢弃Cookie”功能时遇到了一些麻烦
我已将设置的cookie与域xyzcom一起使用,但我尝试丢弃该cookie,但我制作的DiscardingCookie具有相同的名称,但该域设置为yzcom。 cookie会被丢弃吗? 还是该域需要匹配100%并且在子域上不起作用才能丢弃Cookie。
另外,如果我在abc.com上设置了一个Cookie,但又被定向到另一个不存在该Cookie的页面,但是从新的重定向中,进行DiscardingCookie调用以丢弃不再存在的Cookie,那么该Cookie将被丢弃一次我回到abc.com吗? 或该Cookie是否超出范围,因为我不再位于正确的域中
DiscardingCookie
案例类的定义如下:
/**
* A cookie to be discarded. This contains only the data necessary for discarding a cookie.
*
* @param name the name of the cookie to discard
* @param path the path of the cookie, defaults to the root path
* @param domain the cookie domain
* @param secure whether this cookie is secured
*/
case class DiscardingCookie(name: String, path: String = "/", domain: Option[String] = None, secure: Boolean = false) {
def toCookie = Cookie(name, "", Some(-86400), path, domain, secure)
}
如您所见,这里有一个domain
参数。 只需将其设置为Some("xyzcom")
,它就可以为您工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.