public class NewCookie extends Cookie
| Modifier and Type | Class and Description |
|---|---|
static class |
NewCookie.AbstractNewCookieBuilder<T extends NewCookie.AbstractNewCookieBuilder<T>>
JAX-RS abstract
NewCookie builder class. |
static class |
NewCookie.Builder
JAX-RS
NewCookie builder class. |
static class |
NewCookie.SameSite
The available values for the
SameSite cookie attribute. |
Cookie.AbstractCookieBuilder<T extends Cookie.AbstractCookieBuilder<T>>| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_AGE
Specifies that the cookie expires with the current application/browser session.
|
DEFAULT_VERSION| Modifier | Constructor and Description |
|---|---|
|
NewCookie(Cookie cookie)
Deprecated.
This constructor will be removed in a future version. Please use
NewCookie.Builder instead. |
|
NewCookie(Cookie cookie,
java.lang.String comment,
int maxAge,
boolean secure)
Deprecated.
This constructor will be removed in a future version. Please use
NewCookie.Builder instead. |
|
NewCookie(Cookie cookie,
java.lang.String comment,
int maxAge,
java.util.Date expiry,
boolean secure,
boolean httpOnly)
Deprecated.
This constructor will be removed in a future version. Please use
NewCookie.Builder instead. |
|
NewCookie(Cookie cookie,
java.lang.String comment,
int maxAge,
java.util.Date expiry,
boolean secure,
boolean httpOnly,
NewCookie.SameSite sameSite)
Deprecated.
This constructor will be removed in a future version. Please use
NewCookie.Builder instead. |
protected |
NewCookie(NewCookie.AbstractNewCookieBuilder<?> builder)
Create a new instance from the supplied
NewCookie.AbstractNewCookieBuilder instance. |
|
NewCookie(java.lang.String name,
java.lang.String value)
Deprecated.
This constructor will be removed in a future version. Please use
NewCookie.Builder instead. |
|
NewCookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain,
int version,
java.lang.String comment,
int maxAge,
boolean secure)
Deprecated.
This constructor will be removed in a future version. Please use
NewCookie.Builder instead. |
|
NewCookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain,
int version,
java.lang.String comment,
int maxAge,
java.util.Date expiry,
boolean secure,
boolean httpOnly)
Deprecated.
This constructor will be removed in a future version. Please use
NewCookie.Builder instead. |
|
NewCookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain,
int version,
java.lang.String comment,
int maxAge,
java.util.Date expiry,
boolean secure,
boolean httpOnly,
NewCookie.SameSite sameSite)
Deprecated.
This constructor will be removed in a future version. Please use
NewCookie.Builder instead. |
|
NewCookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain,
java.lang.String comment,
int maxAge,
boolean secure)
Deprecated.
This constructor will be removed in a future version. Please use
NewCookie.Builder instead. |
|
NewCookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain,
java.lang.String comment,
int maxAge,
boolean secure,
boolean httpOnly)
Deprecated.
This constructor will be removed in a future version. Please use
NewCookie.Builder instead. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj)
Compare for equality.
|
java.lang.String |
getComment()
Get the comment associated with the cookie.
|
java.util.Date |
getExpiry()
Get the cookie expiry date.
|
int |
getMaxAge()
Get the maximum age of the the cookie in seconds.
|
NewCookie.SameSite |
getSameSite()
Returns the value of the
SameSite attribute for this cookie or null if the attribute is not set. |
int |
hashCode()
Generate a hash code by hashing all of the properties.
|
boolean |
isHttpOnly()
Returns
true if this cookie contains the HttpOnly attribute. |
boolean |
isSecure()
Whether the cookie will only be sent over a secure connection.
|
Cookie |
toCookie()
Obtain a new instance of a
Cookie with the same name, value, path, domain and version as this
NewCookie. |
java.lang.String |
toString()
Deprecated.
The format of the toString() method is subject to change in a future version. Please use
RuntimeDelegate.getInstance().createHeaderDelegate(NewCookie.class).toString(value) instead if you rely on the format
of this method.
|
static NewCookie |
valueOf(java.lang.String value)
Deprecated.
This method will be removed in a future version. Please use
RuntimeDelegate.getInstance().createHeaderDelegate(NewCookie.class).fromString(value) instead.
|
public static final int DEFAULT_MAX_AGE
@Deprecated
public NewCookie(java.lang.String name,
java.lang.String value)
NewCookie.Builder instead.name - the name of the cookie.value - the value of the cookie.java.lang.IllegalArgumentException - if name is null.@Deprecated
public NewCookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain,
java.lang.String comment,
int maxAge,
boolean secure)
NewCookie.Builder instead.name - the name of the cookie.value - the value of the cookie.path - the URI path for which the cookie is valid.domain - the host domain for which the cookie is valid.comment - the comment.maxAge - the maximum age of the cookie in seconds.secure - specifies whether the cookie will only be sent over a secure connection.java.lang.IllegalArgumentException - if name is null.@Deprecated
public NewCookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain,
java.lang.String comment,
int maxAge,
boolean secure,
boolean httpOnly)
NewCookie.Builder instead.name - the name of the cookie.value - the value of the cookie.path - the URI path for which the cookie is valid.domain - the host domain for which the cookie is valid.comment - the comment.maxAge - the maximum age of the cookie in seconds.secure - specifies whether the cookie will only be sent over a secure connection.httpOnly - if true make the cookie HTTP only, i.e. only visible as part of an HTTP request.java.lang.IllegalArgumentException - if name is null.@Deprecated
public NewCookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain,
int version,
java.lang.String comment,
int maxAge,
boolean secure)
NewCookie.Builder instead.name - the name of the cookievalue - the value of the cookiepath - the URI path for which the cookie is validdomain - the host domain for which the cookie is validversion - the version of the specification to which the cookie compliescomment - the commentmaxAge - the maximum age of the cookie in secondssecure - specifies whether the cookie will only be sent over a secure connectionjava.lang.IllegalArgumentException - if name is null.@Deprecated
public NewCookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain,
int version,
java.lang.String comment,
int maxAge,
java.util.Date expiry,
boolean secure,
boolean httpOnly)
NewCookie.Builder instead.name - the name of the cookievalue - the value of the cookiepath - the URI path for which the cookie is validdomain - the host domain for which the cookie is validversion - the version of the specification to which the cookie compliescomment - the commentmaxAge - the maximum age of the cookie in secondsexpiry - the cookie expiry date.secure - specifies whether the cookie will only be sent over a secure connectionhttpOnly - if true make the cookie HTTP only, i.e. only visible as part of an HTTP request.java.lang.IllegalArgumentException - if name is null.@Deprecated
public NewCookie(java.lang.String name,
java.lang.String value,
java.lang.String path,
java.lang.String domain,
int version,
java.lang.String comment,
int maxAge,
java.util.Date expiry,
boolean secure,
boolean httpOnly,
NewCookie.SameSite sameSite)
NewCookie.Builder instead.name - the name of the cookievalue - the value of the cookiepath - the URI path for which the cookie is validdomain - the host domain for which the cookie is validversion - the version of the specification to which the cookie compliescomment - the commentmaxAge - the maximum age of the cookie in secondsexpiry - the cookie expiry date.secure - specifies whether the cookie will only be sent over a secure connectionhttpOnly - if true make the cookie HTTP only, i.e. only visible as part of an HTTP request.sameSite - specifies the value of the SameSite cookie attributejava.lang.IllegalArgumentException - if name is null.@Deprecated public NewCookie(Cookie cookie)
NewCookie.Builder instead.cookie - the cookie to clone.java.lang.IllegalArgumentException - if cookie is null.@Deprecated public NewCookie(Cookie cookie, java.lang.String comment, int maxAge, boolean secure)
NewCookie.Builder instead.cookie - the cookie to clone.comment - the comment.maxAge - the maximum age of the cookie in seconds.secure - specifies whether the cookie will only be sent over a secure connection.java.lang.IllegalArgumentException - if cookie is null.@Deprecated public NewCookie(Cookie cookie, java.lang.String comment, int maxAge, java.util.Date expiry, boolean secure, boolean httpOnly)
NewCookie.Builder instead.cookie - the cookie to clone.comment - the comment.maxAge - the maximum age of the cookie in seconds.expiry - the cookie expiry date.secure - specifies whether the cookie will only be sent over a secure connection.httpOnly - if true make the cookie HTTP only, i.e. only visible as part of an HTTP request.java.lang.IllegalArgumentException - if cookie is null.@Deprecated public NewCookie(Cookie cookie, java.lang.String comment, int maxAge, java.util.Date expiry, boolean secure, boolean httpOnly, NewCookie.SameSite sameSite)
NewCookie.Builder instead.cookie - the cookie to clone.comment - the comment.maxAge - the maximum age of the cookie in seconds.expiry - the cookie expiry date.secure - specifies whether the cookie will only be sent over a secure connection.httpOnly - if true make the cookie HTTP only, i.e. only visible as part of an HTTP request.sameSite - specifies the value of the SameSite cookie attributejava.lang.IllegalArgumentException - if cookie is null.protected NewCookie(NewCookie.AbstractNewCookieBuilder<?> builder)
NewCookie.AbstractNewCookieBuilder instance.builder - the builder.java.lang.IllegalArgumentException - if builder.name is null.@Deprecated public static NewCookie valueOf(java.lang.String value)
value - the cookie string.NewCookie.java.lang.IllegalArgumentException - if the supplied string cannot be parsed or is null.public java.lang.String getComment()
public int getMaxAge()
-1 indicates that the cookie will be discarded at the end of the
browser/application session.
Note that it is recommended to use Max-Age to control cookie expiration, however some browsers do not
understand Max-Age, in which case setting getExpiry() Expires} parameter may be necessary.
getExpiry()public java.util.Date getExpiry()
Note that it is recommended to use Max-Age to control cookie expiration, however some browsers
do not understand Max-Age, in which case setting Expires parameter may be necessary.
null if no expiry date was set.getMaxAge()public boolean isSecure()
false.true if the cookie will only be sent over a secure connection, false otherwise.public boolean isHttpOnly()
true if this cookie contains the HttpOnly attribute. This means that the cookie should not be
accessible to scripting engines, like javascript.true if this cookie should be considered http only, false otherwise.public NewCookie.SameSite getSameSite()
SameSite attribute for this cookie or null if the attribute is not set.
This attributes controls whether the cookie is sent with cross-origin requests, providing protection against
cross-site request forgery.SameSite cookie attribute or null.public Cookie toCookie()
Cookie with the same name, value, path, domain and version as this
NewCookie. This method can be used to obtain an object that can be compared for equality with another
Cookie; since a Cookie will never compare equal to a NewCookie.Cookie@Deprecated public java.lang.String toString()
public int hashCode()
public boolean equals(java.lang.Object obj)
toCookie() to compare a NewCookie to a Cookie considering only the
common properties.