public final class ResponseCookie extends HttpCookie
HttpCookie sub-class with the additional attributes allowed in
the "Set-Cookie" response header. To build an instance use the from(java.lang.String, java.lang.String)
static method.| Modifier and Type | Class and Description |
|---|---|
static interface |
ResponseCookie.ResponseCookieBuilder
A builder for a server-defined HttpCookie with attributes.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other) |
static ResponseCookie.ResponseCookieBuilder |
from(String name,
String value)
Factory method to obtain a builder for a server-defined cookie that starts
with a name-value pair and may also include attributes.
|
Optional<String> |
getDomain()
Return the cookie "Domain" attribute.
|
Duration |
getMaxAge()
Return the cookie "Max-Age" attribute in seconds.
|
Optional<String> |
getPath()
Return the cookie "Path" attribute.
|
int |
hashCode() |
boolean |
isHttpOnly()
Return
true if the cookie has the "HttpOnly" attribute. |
boolean |
isSecure()
Return
true if the cookie has the "Secure" attribute. |
getName, getValuepublic Duration getMaxAge()
A positive value indicates when the cookie expires relative to the current time. A value of 0 means the cookie should expire immediately. A negative value means no "Max-Age" attribute in which case the cookie is removed when the browser is closed.
public boolean isSecure()
true if the cookie has the "Secure" attribute.public boolean isHttpOnly()
true if the cookie has the "HttpOnly" attribute.public int hashCode()
hashCode in class HttpCookiepublic boolean equals(Object other)
equals in class HttpCookiepublic static ResponseCookie.ResponseCookieBuilder from(String name, String value)
name - the cookie namevalue - the cookie value