| Modifier and Type | Class and Description |
|---|---|
| public abstract static class | NewCookie.
the current AbstractNewCookieBuilder type. T extends NewCookie.JAX-RS abstract |
| public static class | NewCookie.
JAX-RS |
| public static enum | NewCookie.
The available values for the |
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| public static final int | DEFAULT_MAX_AGE
Specifies that the cookie expires with the current application/browser session. |
| private static final RuntimeDelegate. | DELEGATE
Deprecated
This field will be removed in a future version. See https://github.com/jakartaee/rest/issues/607
|
| private final Date | |
| private final boolean | |
| private final int | |
| private final NewCookie. | |
| private final boolean |
| Access | Constructor and Description |
|---|---|
| public | NewCookie(final String
the name of the cookie. name, final String the value of the cookie. value)
Deprecated
This constructor will be removed in a future version. Please use
NewCookie. instead.
Create a new instance. |
| public | NewCookie(final String
the name of the cookie. name, final String the value of the cookie. value, final String the URI path for which the cookie is valid. path, final String the host domain for which the cookie is valid. domain, final String the comment. comment, final int the maximum age of the cookie in seconds. maxAge, final boolean specifies whether the cookie will only be sent over a secure connection. secure)
Deprecated
This constructor will be removed in a future version. Please use
NewCookie. instead.
Create a new instance. |
| public | NewCookie(final String
the name of the cookie. name, final String the value of the cookie. value, final String the URI path for which the cookie is valid. path, final String the host domain for which the cookie is valid. domain, final String the comment. comment, final int the maximum age of the cookie in seconds. maxAge, final boolean specifies whether the cookie will only be sent over a secure connection. secure, final boolean if httpOnly)true make the cookie HTTP only, i.e. only visible as part of an HTTP request.
Deprecated
This constructor will be removed in a future version. Please use
NewCookie. instead.
Create a new instance. |
| public | NewCookie(final String
the name of the cookie name, final String the value of the cookie value, final String the URI path for which the cookie is valid path, final String the host domain for which the cookie is valid domain, final int the version of the specification to which the cookie complies version, final String the comment comment, final int the maximum age of the cookie in seconds maxAge, final boolean specifies whether the cookie will only be sent over a secure connection secure)
Deprecated
This constructor will be removed in a future version. Please use
NewCookie. instead.
Create a new instance. |
| public | NewCookie(final String
the name of the cookie name, final String the value of the cookie value, final String the URI path for which the cookie is valid path, final String the host domain for which the cookie is valid domain, final int the version of the specification to which the cookie complies version, final String the comment comment, final int the maximum age of the cookie in seconds maxAge, final Date the cookie expiry date. expiry, final boolean specifies whether the cookie will only be sent over a secure connection secure, final boolean if httpOnly)true make the cookie HTTP only, i.e. only visible as part of an HTTP request.
Deprecated
This constructor will be removed in a future version. Please use
NewCookie. instead.
Create a new instance. |
| public | NewCookie(final String
the name of the cookie name, final String the value of the cookie value, final String the URI path for which the cookie is valid path, final String the host domain for which the cookie is valid domain, final int the version of the specification to which the cookie complies version, final String the comment comment, final int the maximum age of the cookie in seconds maxAge, final Date the cookie expiry date. expiry, final boolean specifies whether the cookie will only be sent over a secure connection secure, final boolean if httpOnly, final NewCookie.true make the cookie HTTP only, i.e. only visible as part of an HTTP request.specifies the value of the sameSiteSameSite cookie attribute
Deprecated
This constructor will be removed in a future version. Please use
NewCookie. instead.
Create a new instance. |
| public | NewCookie(final Cookie
the cookie to clone. cookie)
Deprecated
This constructor will be removed in a future version. Please use
NewCookie. instead.
Create a new instance copying the information in the supplied cookie. |
| public | NewCookie(final Cookie
the cookie to clone. cookie, final String the comment. comment, final int the maximum age of the cookie in seconds. maxAge, final boolean specifies whether the cookie will only be sent over a secure connection. secure)
Deprecated
This constructor will be removed in a future version. Please use
NewCookie. instead.
Create a new instance supplementing the information in the supplied cookie. |
| public | NewCookie(final Cookie
the cookie to clone. cookie, final String the comment. comment, final int the maximum age of the cookie in seconds. maxAge, final Date the cookie expiry date. expiry, final boolean specifies whether the cookie will only be sent over a secure connection. secure, final boolean if httpOnly)true make the cookie HTTP only, i.e. only visible as part of an HTTP request.
Deprecated
This constructor will be removed in a future version. Please use
NewCookie. instead.
Create a new instance supplementing the information in the supplied cookie. |
| public | NewCookie(final Cookie
the cookie to clone. cookie, final String the comment. comment, final int the maximum age of the cookie in seconds. maxAge, final Date the cookie expiry date. expiry, final boolean specifies whether the cookie will only be sent over a secure connection. secure, final boolean if httpOnly, final NewCookie.true make the cookie HTTP only, i.e. only visible as part of an HTTP request.specifies the value of the sameSiteSameSite cookie attribute
Deprecated
This constructor will be removed in a future version. Please use
NewCookie. instead.
Create a new instance supplementing the information in the supplied cookie. |
| protected | NewCookie(NewCookie.
the builder. builderCreate a new instance from the supplied |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if the object is aNewCookie with the same value for all properties, false otherwise.the object to compare to obj)Overrides jakarta. Compare for equality. |
| public String | |
| public Date | Returns: cookie expiry date ornull if no expiry date was set.Get the cookie expiry date. |
| public int | |
| public NewCookie. | Returns: the value of theSameSite cookie attribute or null.Returns the value of the |
| public int | Returns: the hash code.Overrides jakarta. Generate a hash code by hashing all of the properties. |
| public boolean | Returns: true if this cookie should be considered http only, false otherwise.Returns |
| public boolean | Returns: true if the cookie will only be sent over a secure connection, false otherwise.Whether the cookie will only be sent over a secure connection. |
| public Cookie | |
| public String | Returns: a stringified cookie.Overrides jakarta.
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.
Convert the cookie to a string suitable for use as the value of the corresponding HTTP header. |
| public static NewCookie | Returns: the newly createdNewCookie.the cookie string. value)Hides jakarta.
Deprecated
This method will be removed in a future version. Please use
RuntimeDelegate.getInstance().createHeaderDelegate(NewCookie.class).fromString(value) instead.
Creates a new instance of NewCookie by parsing the supplied string. |
| comment | back to summary |
|---|---|
| private final String comment | |
| DEFAULT_MAX_AGE | back to summary |
|---|---|
| public static final int DEFAULT_MAX_AGE Specifies that the cookie expires with the current application/browser session. | |
| DELEGATE | back to summary |
|---|---|
| private static final RuntimeDelegate. Deprecated This field will be removed in a future version. See https://github.com/jakartaee/rest/issues/607 | |
| expiry | back to summary |
|---|---|
| private final Date expiry | |
| httpOnly | back to summary |
|---|---|
| private final boolean httpOnly | |
| maxAge | back to summary |
|---|---|
| private final int maxAge | |
| sameSite | back to summary |
|---|---|
| private final NewCookie. | |
| secure | back to summary |
|---|---|
| private final boolean secure | |
| NewCookie | back to summary |
|---|---|
| public NewCookie(final String name, final String value)
Deprecated This constructor will be removed in a future version. Please use Create a new instance.
| |
| NewCookie | back to summary |
|---|---|
| public NewCookie(final String name, final String value, final String path, final String domain, final String comment, final int maxAge, final boolean secure)
Deprecated This constructor will be removed in a future version. Please use Create a new instance.
| |
| NewCookie | back to summary |
|---|---|
| public NewCookie(final String name, final String value, final String path, final String domain, final String comment, final int maxAge, final boolean secure, final boolean httpOnly)
Deprecated This constructor will be removed in a future version. Please use Create a new instance.
| |
| NewCookie | back to summary |
|---|---|
| public NewCookie(final String name, final String value, final String path, final String domain, final int version, final String comment, final int maxAge, final boolean secure)
Deprecated This constructor will be removed in a future version. Please use Create a new instance.
| |
| NewCookie | back to summary |
|---|---|
| public NewCookie(final String name, final String value, final String path, final String domain, final int version, final String comment, final int maxAge, final Date expiry, final boolean secure, final boolean httpOnly)
Deprecated This constructor will be removed in a future version. Please use Create a new instance.
| |
| NewCookie | back to summary |
|---|---|
| public NewCookie(final String name, final String value, final String path, final String domain, final int version, final String comment, final int maxAge, final Date expiry, final boolean secure, final boolean httpOnly, final NewCookie. Deprecated This constructor will be removed in a future version. Please use Create a new instance.
| |
| NewCookie | back to summary |
|---|---|
| public NewCookie(final Cookie cookie)
Deprecated This constructor will be removed in a future version. Please use Create a new instance copying the information in the supplied cookie.
| |
| NewCookie | back to summary |
|---|---|
| public NewCookie(final Cookie cookie, final String comment, final int maxAge, final boolean secure)
Deprecated This constructor will be removed in a future version. Please use Create a new instance supplementing the information in the supplied cookie.
| |
| NewCookie | back to summary |
|---|---|
| public NewCookie(final Cookie cookie, final String comment, final int maxAge, final Date expiry, final boolean secure, final boolean httpOnly)
Deprecated This constructor will be removed in a future version. Please use Create a new instance supplementing the information in the supplied cookie.
| |
| NewCookie | back to summary |
|---|---|
| public NewCookie(final Cookie cookie, final String comment, final int maxAge, final Date expiry, final boolean secure, final boolean httpOnly, final NewCookie. Deprecated This constructor will be removed in a future version. Please use Create a new instance supplementing the information in the supplied cookie.
| |
| NewCookie | back to summary |
|---|---|
| protected NewCookie(NewCookie. Create a new instance from the supplied
| |
| equals | back to summary |
|---|---|
| public boolean equals(final Object obj) Overrides jakarta. Compare for equality. Use
| |
| getComment | back to summary |
|---|---|
| public String getComment() Get the comment associated with the cookie.
| |
| getExpiry | back to summary |
|---|---|
| public Date getExpiry() Get the cookie expiry date. Cookies whose expiry date has passed are discarded. A cookie can be unset by setting a new cookie with an expiry date in the past, typically the lowest possible date that can be set.
Note that it is recommended to use
| |
| getMaxAge | back to summary |
|---|---|
| public int getMaxAge() Get the maximum age of the the cookie in seconds. Cookies older than the maximum age are discarded. A cookie can be
unset by sending a new cookie with maximum age of 0 since it will overwrite any existing cookie and then be
immediately discarded. The default value of
Note that it is recommended to use
| |
| getSameSite | back to summary |
|---|---|
| public NewCookie. Returns the value of the | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides jakarta. Generate a hash code by hashing all of the properties.
| |
| isHttpOnly | back to summary |
|---|---|
| public boolean isHttpOnly() Returns
| |
| isSecure | back to summary |
|---|---|
| public boolean isSecure() Whether the cookie will only be sent over a secure connection. Defaults to
| |
| toCookie | back to summary |
|---|---|
| public Cookie toCookie() Obtain a new instance of a | |
| toString | back to summary |
|---|---|
| public String toString() Overrides jakarta. 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. Convert the cookie to a string suitable for use as the value of the corresponding HTTP header.
| |
| valueOf | back to summary |
|---|---|
| public static NewCookie valueOf(final String value) Hides jakarta. Deprecated This method will be removed in a future version. Please use RuntimeDelegate.getInstance().createHeaderDelegate(NewCookie.class).fromString(value) instead. Creates a new instance of NewCookie by parsing the supplied string.
| |
NewCookie builder class.
| Modifier and Type | Field and Description |
|---|---|
| private String | |
| private Date | |
| private boolean | |
| private int | |
| private NewCookie. | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public | AbstractNewCookieBuilder(Cookie
the cookie to clone. cookie)Create a new instance supplementing the information in the supplied cookie. |
| Modifier and Type | Method and Description |
|---|---|
| public abstract NewCookie | Returns: a newNewCookie instance.Implements abstract jakarta. Build a new |
| public T | |
| public T | |
| public T | Returns: the updated builder instance.if httpOnly)true make the cookie HTTP only, i.e. only visible as part of an HTTP request.Whether the cookie will only be visible as part of an HTTP request. |
| public T | Returns: the updated builder instance.the maximum age in seconds. maxAge)Set the maximum age of the the cookie in seconds. |
| public T | |
| public T | Returns: the updated builder instance.specifies whether the cookie will only be sent over a secure connection. secure)Whether the cookie will only be sent over a secure connection. |
| private T |
| comment | back to summary |
|---|---|
| private String comment | |
| expiry | back to summary |
|---|---|
| private Date expiry | |
| httpOnly | back to summary |
|---|---|
| private boolean httpOnly | |
| maxAge | back to summary |
|---|---|
| private int maxAge | |
| sameSite | back to summary |
|---|---|
| private NewCookie. | |
| secure | back to summary |
|---|---|
| private boolean secure | |
| AbstractNewCookieBuilder | back to summary |
|---|---|
| public AbstractNewCookieBuilder(String name) Create a new instance.
| |
| AbstractNewCookieBuilder | back to summary |
|---|---|
| public AbstractNewCookieBuilder(Cookie cookie) Create a new instance supplementing the information in the supplied cookie.
| |
| build | back to summary |
|---|---|
| public abstract NewCookie build() Implements abstract jakarta. Build a new
| |
| comment | back to summary |
|---|---|
| public T comment(String comment) Set the comment associated with the cookie.
| |
| expiry | back to summary |
|---|---|
| public T expiry(Date expiry) Set the cookie expiry date. Cookies whose expiry date has passed are discarded. A cookie can be unset by setting a new cookie with an expiry date in the past, typically the lowest possible date that can be set.
Note that it is recommended to use
| |
| httpOnly | back to summary |
|---|---|
| public T httpOnly(boolean httpOnly) Whether the cookie will only be visible as part of an HTTP request. Defaults to
| |
| maxAge | back to summary |
|---|---|
| public T maxAge(int maxAge) Set the maximum age of the the cookie in seconds. Cookies older than the maximum age are discarded. A cookie can be
unset by sending a new cookie with maximum age of 0 since it will overwrite any existing cookie and then be
immediately discarded. The default value of
| |
| sameSite | back to summary |
|---|---|
| public T sameSite(NewCookie. Set the attribute that controls whether the cookie is sent with cross-origin requests, providing protection against cross-site request forgery. | |
| secure | back to summary |
|---|---|
| public T secure(boolean secure) Whether the cookie will only be sent over a secure connection. Defaults to
| |
| self | back to summary |
|---|---|
| private T self() Hides jakarta.
| |
NewCookie builder class.
New Cookie builder provides methods that let you conveniently configure and subsequently build a new
NewCookie instance.
NewCookie cookie = new NewCookie.Builder("name")
.path("/")
.domain("domain.com")
.sameSite(SameSite.LAX)
.build();
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public NewCookie | build()
Implements abstract jakarta. Build a new |
| Builder | back to summary |
|---|---|
| public Builder(String name) Create a new instance.
| |
| Builder | back to summary |
|---|---|
| public Builder(Cookie cookie) Create a new instance supplementing the information in the supplied cookie.
| |
| build | back to summary |
|---|---|
| public NewCookie build() Implements abstract jakarta. Doc from jakarta. Build a new | |
SameSite cookie attribute.
| Modifier and Type | Field and Description |
|---|---|
| public static final NewCookie. | LAX
The |
| public static final NewCookie. | NONE
The |
| public static final NewCookie. | STRICT
The |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static NewCookie. | |
| public static NewCookie. |
| LAX | back to summary |
|---|---|
| public static final NewCookie. The | |
| NONE | back to summary |
|---|---|
| public static final NewCookie. The | |
| STRICT | back to summary |
|---|---|
| public static final NewCookie. The | |
| SameSite | back to summary |
|---|---|
| private SameSite() | |
| valueOf | back to summary |
|---|---|
| public static NewCookie. | |
| values | back to summary |
|---|---|
| public static NewCookie. | |