All cookies must have a name and a value and can optionally have other fields set such as path, domain, etc.
| Modifier and Type | Method and Description |
|---|---|
| public static Cookie | |
| public String | |
| public @Nullable String | |
| public long | |
| public String | |
| public @Nullable String | |
| public @Nullable CookieSameSite | |
| public String | |
| public boolean | |
| public boolean | |
| public Cookie | |
| public Cookie | setHttpOnly(boolean
True if the cookie is HTTP only, otherwise false. httpOnly)Determines if this cookie is HTTP only. |
| public Cookie | setMaxAge(long
The maximum age of this cookie in seconds maxAge)Sets the maximum age of this cookie in seconds. |
| public Cookie | |
| public Cookie | Returns: a reference to this, so the API can be used fluentlyThe policy should be one of policy)CookieSameSite.Sets the same site of this cookie. |
| public Cookie | Returns: a reference to this, so the API can be used fluentlyTrue if this cookie is to be secure, otherwise false secure)Sets the security getStatus of this cookie |
| public Cookie |
| cookie | back to summary |
|---|---|
| public static Cookie cookie(String name, String value) Create a new cookie | |
| encode | back to summary |
|---|---|
| public String encode() Encode the cookie to a string. This is what is used in the Set-Cookie header
| |
| getDomain | back to summary |
|---|---|
| public @Nullable String getDomain() | |
| getMaxAge | back to summary |
|---|---|
public long getMaxAge()
| |
| getName | back to summary |
|---|---|
public String getName()
| |
| getPath | back to summary |
|---|---|
| public @Nullable String getPath() | |
| getSameSite | back to summary |
|---|---|
public @Nullable CookieSameSite getSameSite()
| |
| getValue | back to summary |
|---|---|
public String getValue()
| |
| isHttpOnly | back to summary |
|---|---|
public boolean isHttpOnly()
| |
| isSecure | back to summary |
|---|---|
public boolean isSecure()
| |
| setDomain | back to summary |
|---|---|
| public Cookie setDomain(@Nullable String domain) Sets the domain of this cookie | |
| setHttpOnly | back to summary |
|---|---|
| public Cookie setHttpOnly(boolean httpOnly) Determines if this cookie is HTTP only. If set to true, this cookie cannot be accessed by a client side script. However, this works only if the browser supports it. For for information, please look here.
| |
| setMaxAge | back to summary |
|---|---|
| public Cookie setMaxAge(long maxAge) Sets the maximum age of this cookie in seconds.
If an age of
| |
| setPath | back to summary |
|---|---|
| public Cookie setPath(@Nullable String path) Sets the path of this cookie. | |
| setSameSite | back to summary |
|---|---|
| public Cookie setSameSite(CookieSameSite policy) Sets the same site of this cookie.
| |
| setSecure | back to summary |
|---|---|
| public Cookie setSecure(boolean secure) Sets the security getStatus of this cookie | |
| setValue | back to summary |
|---|---|
| public Cookie setValue(String value) Sets the value of this cookie | |