| Constructor and Description |
|---|
DefaultCookie(String name,
String value)
Creates a new cookie with the specified name and value.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Cookie c) |
String |
domain()
Returns the domain of this
Cookie. |
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
isHttpOnly()
Checks to see if this
Cookie can only be accessed via HTTP. |
boolean |
isSecure()
Checks to see if this
Cookie is secure |
int |
maxAge()
Returns the maximum age of this
Cookie in seconds or Integer.MIN_VALUE if
unspecified |
String |
name()
Returns the name of this
Cookie. |
String |
path()
Returns the path of this
Cookie. |
String |
sameSite()
Returns the SameSite attribute of this cookie as a String
|
void |
setDomain(String domain)
Sets the domain of this
Cookie. |
void |
setHttpOnly(boolean httpOnly)
Determines if this
Cookie is HTTP only. |
void |
setMaxAge(int maxAge)
Sets the maximum age of this
Cookie in seconds. |
void |
setPath(String path)
Sets the path of this
Cookie. |
void |
setSameSite(String sameSite) |
void |
setSecure(boolean secure)
Sets the security getStatus of this
Cookie |
void |
setValue(String value)
Sets the value of this
Cookie. |
void |
setWrap(boolean wrap)
Sets true if the value of this
Cookie is to be wrapped with double quotes. |
String |
toString() |
protected String |
validateValue(String name,
String value)
Deprecated.
CookieUtil is package private, will be removed once old Cookie API is dropped
|
String |
value()
Returns the value of this
Cookie. |
boolean |
wrap()
Returns true if the raw value of this
Cookie, was wrapped with double quotes in
original Set-Cookie header. |
public String name()
CookieCookie.public String value()
CookieCookie.public void setValue(String value)
CookieCookie.public boolean wrap()
CookieCookie, was wrapped with double quotes in
original Set-Cookie header.public void setWrap(boolean wrap)
CookieCookie is to be wrapped with double quotes.public String domain()
CookieCookie.public void setDomain(String domain)
CookieCookie.public String path()
CookieCookie.public void setPath(String path)
CookieCookie.public int maxAge()
CookieCookie in seconds or Integer.MIN_VALUE if
unspecifiedpublic void setMaxAge(int maxAge)
CookieCookie in seconds. If an age of 0 is specified,
this Cookie will be automatically removed by browser because it will expire
immediately. If Integer.MIN_VALUE is specified, this Cookie will be removed
when the browser is closed.public boolean isSecure()
CookieCookie is securepublic void setSecure(boolean secure)
CookieCookiepublic String sameSite()
Cookiepublic void setSameSite(String sameSite)
public boolean isHttpOnly()
CookieCookie 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. For more information, please look hereisHttpOnly in interface CookieCookie is HTTP-only or false if it isn'tpublic void setHttpOnly(boolean httpOnly)
CookieCookie 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.setHttpOnly in interface CookiehttpOnly - True if the Cookie is HTTP only, otherwise false.public int compareTo(Cookie c)
compareTo in interface Comparable<Cookie>@Deprecated protected String validateValue(String name, String value)
IllegalArgumentException otherwise. Only
intended to be used by DefaultCookie.name - attribute namevalue - attribute value