public interface Cookie extends Comparable<Cookie>, Serializable
Modifier and Type | Method and Description |
---|---|
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
String getName()
String getValue()
String getDomain()
Domain names are formatted according to RFC 2109.
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()
Cookie maxAge(long maxAge)
maxAge
- The max ageCookie value(String value)
value
- The value of the cookieCookie domain(String domain)
domain
- The domain of the cookieCookie path(String path)
path
- The path of the cookieCookie secure(boolean secure)
secure
- Is the cookie secureCookie httpOnly(boolean httpOnly)
httpOnly
- Is the cookie HTTP-Onlydefault Cookie maxAge(TemporalAmount maxAge)
maxAge
- The max age