在Cookie.java中,当我们发送带有max-age的cookie作为使cookie过期的负面时,它会引发异常。
在他们的代码中很清楚
/**
* Set the maximum age of the cookie, specified in seconds,
* By default, <code>-1</code> indicating the cookie will persist
* until browser shutdown.
*
* @return an integer specifying the maximum age of the
* cookie in seconds; if negative, means
* the cookie persists until browser shutdown
*/
public Builder setMaxAge(int maxAge) {
if(maxAge < 0) {
throw new IllegalArgumentException("Max-Age cannot be less than 0");
}
this.maxAge = maxAge;
return this;
}
然而,评论支持负值,并清楚地表明负值意味着cookie一直持续到浏览器关闭。
他们是否可以发送cookie以响应max-age的负值,因为问题尚未在他们的代码中处理?