public interface Cookie extends Comparable<Cookie>, Serializable
Modifier and Type | Method and Description |
---|---|
default Cookie |
configure(CookieConfiguration configuration)
Configure the Cookie with the given configuration.
|
default Cookie |
configure(CookieConfiguration configuration,
boolean isSecure)
Configure the Cookie with the given configuration.
|
Cookie |
domain(String domain)
Sets the domain of the cookie.
|
String |
getDomain()
Gets the domain name of this Cookie.
|
long |
getMaxAge() |
String |
getName() |
String |
getPath()
The path of the cookie.
|
String |
getValue() |
Cookie |
httpOnly(boolean httpOnly)
Sets whether the cookie is HTTP-Only.
|
boolean |
isHttpOnly()
Checks to see if this
Cookie can only be accessed via HTTP. |
boolean |
isSecure() |
Cookie |
maxAge(long maxAge)
Sets the max age of the cookie in seconds.
|
default Cookie |
maxAge(TemporalAmount maxAge)
Sets the max age of the cookie in seconds.
|
static Cookie |
of(String name,
String value)
Construct a new Cookie for the given name and value.
|
Cookie |
path(String path)
Sets the path of the cookie.
|
Cookie |
secure(boolean secure)
Sets whether the cookie is secure.
|
Cookie |
value(String value)
Sets the value.
|
compareTo
@Nullable String getDomain()
Domain names are formatted according to RFC 2109.
@Nullable String getPath()
boolean isHttpOnly()
Cookie
can only be accessed via HTTP.
If this returns true, the Cookie
cannot be accessed through client side script - But only if the
browser supports it.
See here for reference
Cookie
is HTTP-only or false if it isn'tboolean isSecure()
long getMaxAge()
@Nonnull Cookie maxAge(long maxAge)
maxAge
- The max age@Nonnull Cookie value(@Nonnull String value)
value
- The value of the cookie@Nonnull Cookie domain(@Nullable String domain)
domain
- The domain of the cookie@Nonnull Cookie path(@Nullable String path)
path
- The path of the cookie@Nonnull Cookie secure(boolean secure)
secure
- Is the cookie secure@Nonnull Cookie httpOnly(boolean httpOnly)
httpOnly
- Is the cookie HTTP-Only@Nonnull default Cookie configure(@Nonnull CookieConfiguration configuration)
configuration
- The configuration@Nonnull default Cookie configure(@Nonnull CookieConfiguration configuration, boolean isSecure)
configuration
- The configurationisSecure
- Is the request secure@Nonnull default Cookie maxAge(@Nonnull TemporalAmount maxAge)
maxAge
- The max age