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.
|
default Optional<SameSite> |
getSameSite()
Checks to see if this
Cookie can be sent along cross-site requests. |
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.
|
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.
|
default Cookie |
sameSite(SameSite sameSite)
Determines if this this
Cookie can be sent along cross-site requests. |
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()
default Optional<SameSite> getSameSite()
Cookie
can be sent along cross-site requests.
For more information, please look
here@NonNull default Cookie sameSite(@Nullable SameSite sameSite)
Cookie
can be sent along cross-site requests.
For more information, please look
heresameSite
- SameSite value@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