diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/cookie/Cookie.java b/codec-http/src/main/java/io/netty/handler/codec/http/cookie/Cookie.java index 7633477e14..f128f1cace 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/cookie/Cookie.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/cookie/Cookie.java @@ -21,6 +21,11 @@ package io.netty.handler.codec.http.cookie; */ public interface Cookie extends Comparable { + /** + * Constant for undefined MaxAge attribute value. + */ + long UNDEFINED_MAX_AGE = Long.MIN_VALUE; + /** * Returns the name of this {@link Cookie}. * @@ -87,7 +92,7 @@ public interface Cookie extends Comparable { void setPath(String path); /** - * Returns the maximum age of this {@link Cookie} in seconds or {@link Long#MIN_VALUE} if unspecified + * Returns the maximum age of this {@link Cookie} in seconds or {@link Cookie#UNDEFINED_MAX_AGE} if unspecified * * @return The maximum age of this {@link Cookie} */ @@ -97,7 +102,7 @@ public interface Cookie extends Comparable { * Sets the maximum age of this {@link Cookie} in seconds. * If an age of {@code 0} is specified, this {@link Cookie} will be * automatically removed by browser because it will expire immediately. - * If {@link Long#MIN_VALUE} is specified, this {@link Cookie} will be removed when the + * If {@link Cookie#UNDEFINED_MAX_AGE} is specified, this {@link Cookie} will be removed when the * browser is closed. * * @param maxAge The maximum age of this {@link Cookie} in seconds diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/cookie/DefaultCookie.java b/codec-http/src/main/java/io/netty/handler/codec/http/cookie/DefaultCookie.java index 319df83cfa..cbd54cd092 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/cookie/DefaultCookie.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/cookie/DefaultCookie.java @@ -28,7 +28,7 @@ public class DefaultCookie implements Cookie { private boolean wrap; private String domain; private String path; - private long maxAge = Long.MIN_VALUE; + private long maxAge = UNDEFINED_MAX_AGE; private boolean secure; private boolean httpOnly;