parent
9b37de32a0
commit
bdde5a20f6
@ -87,7 +87,7 @@ public interface Cookie extends Comparable<Cookie> {
|
|||||||
void setComment(String comment);
|
void setComment(String comment);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the maximum age of this {@link Cookie} in seconds.
|
* Returns the maximum age of this {@link Cookie} in seconds or {@link Long#MIN_VALUE} if unspecified
|
||||||
*
|
*
|
||||||
* @return The maximum age of this {@link Cookie}
|
* @return The maximum age of this {@link Cookie}
|
||||||
*/
|
*/
|
||||||
@ -97,7 +97,7 @@ public interface Cookie extends Comparable<Cookie> {
|
|||||||
* Sets the maximum age of this {@link Cookie} in seconds.
|
* Sets the maximum age of this {@link Cookie} in seconds.
|
||||||
* If an age of {@code 0} is specified, this {@link Cookie} will be
|
* If an age of {@code 0} is specified, this {@link Cookie} will be
|
||||||
* automatically removed by browser because it will expire immediately.
|
* automatically removed by browser because it will expire immediately.
|
||||||
* If {@code -1} is specified, this {@link Cookie} will be removed when the
|
* If {@link Long#MIN_VALUE} is specified, this {@link Cookie} will be removed when the
|
||||||
* browser is closed.
|
* browser is closed.
|
||||||
*
|
*
|
||||||
* @param maxAge The maximum age of this {@link Cookie} in seconds
|
* @param maxAge The maximum age of this {@link Cookie} in seconds
|
||||||
|
@ -35,7 +35,7 @@ public class DefaultCookie implements Cookie {
|
|||||||
private boolean discard;
|
private boolean discard;
|
||||||
private Set<Integer> ports = Collections.emptySet();
|
private Set<Integer> ports = Collections.emptySet();
|
||||||
private Set<Integer> unmodifiablePorts = ports;
|
private Set<Integer> unmodifiablePorts = ports;
|
||||||
private long maxAge = -1;
|
private long maxAge = Long.MIN_VALUE;
|
||||||
private int version;
|
private int version;
|
||||||
private boolean secure;
|
private boolean secure;
|
||||||
private boolean httpOnly;
|
private boolean httpOnly;
|
||||||
|
@ -54,7 +54,7 @@ public final class ServerCookieEncoder {
|
|||||||
|
|
||||||
add(buf, cookie.getName(), cookie.getValue());
|
add(buf, cookie.getName(), cookie.getValue());
|
||||||
|
|
||||||
if (cookie.getMaxAge() >= 0) {
|
if (cookie.getMaxAge() != Long.MIN_VALUE) {
|
||||||
if (cookie.getVersion() == 0) {
|
if (cookie.getVersion() == 0) {
|
||||||
addUnquoted(buf, CookieHeaderNames.EXPIRES,
|
addUnquoted(buf, CookieHeaderNames.EXPIRES,
|
||||||
new HttpHeaderDateFormat().format(
|
new HttpHeaderDateFormat().format(
|
||||||
|
Loading…
Reference in New Issue
Block a user