public final class DefaultHttpSetCookie extends Object implements HttpSetCookie
HttpSetCookie.HttpSetCookie.SameSite| Constructor and Description |
|---|
DefaultHttpSetCookie(CharSequence name,
CharSequence value)
Create a new not wrapped, not secure and not HTTP-only
HttpSetCookie instance, with no path, domain,
expire date and maximum age. |
DefaultHttpSetCookie(CharSequence name,
CharSequence value,
boolean wrapped,
boolean secure,
boolean httpOnly)
Create a new
HttpSetCookie instance, with no path, domain, expire date and maximum age. |
DefaultHttpSetCookie(CharSequence name,
CharSequence value,
CharSequence path,
CharSequence domain,
CharSequence expires,
Long maxAge,
HttpSetCookie.SameSite sameSite,
boolean wrapped,
boolean secure,
boolean httpOnly)
Creates a new
HttpSetCookie instance. |
| Modifier and Type | Method and Description |
|---|---|
CharSequence |
domain()
Returns the domain of this
HttpSetCookie. |
CharSequence |
encoded()
Get the encoded value of this
HttpCookiePair. |
boolean |
equals(Object o) |
CharSequence |
expires()
Returns the expire date of this
HttpSetCookie according
to Expires. |
int |
hashCode() |
boolean |
isHttpOnly()
Checks to see if this
HttpSetCookie can only be accessed via HTTP. |
boolean |
isSecure()
Checks to see if this
HttpSetCookie is secure. |
boolean |
isWrapped()
Returns
true if the value should be wrapped in DQUOTE as described in
cookie-value. |
Long |
maxAge()
Returns the maximum age of this
HttpSetCookie in seconds if specified. |
CharSequence |
name()
Returns the name of this
HttpCookiePair. |
static HttpSetCookie |
parseSetCookie(CharSequence setCookieString,
boolean validateContent)
|
CharSequence |
path()
Returns the path of this
HttpSetCookie. |
HttpSetCookie.SameSite |
sameSite()
Get the value for the
SameSite attribute.
|
String |
toString() |
CharSequence |
value()
Returns the value of this
HttpCookiePair. |
public DefaultHttpSetCookie(CharSequence name,
CharSequence value)
HttpSetCookie instance, with no path, domain,
expire date and maximum age.name - the cookie-name.value - the cookie-value.public DefaultHttpSetCookie(CharSequence name,
CharSequence value,
boolean wrapped,
boolean secure,
boolean httpOnly)
HttpSetCookie instance, with no path, domain, expire date and maximum age.name - the cookie-name.value - the cookie-value.wrapped - true if the value should be wrapped in DQUOTE as described in
cookie-value.secure - the secure-av.httpOnly - the httponly-av (see
HTTP-only).public DefaultHttpSetCookie(CharSequence name,
CharSequence value,
@Nullable
CharSequence path,
@Nullable
CharSequence domain,
@Nullable
CharSequence expires,
@Nullable
Long maxAge,
@Nullable
HttpSetCookie.SameSite sameSite,
boolean wrapped,
boolean secure,
boolean httpOnly)
HttpSetCookie instance.name - the cookie-name.value - the cookie-value.path - the path-value.domain - the domain-value.expires - the expires-av.
Represented as an RFC-1123 date defined in
RFC-2616, Section 3.3.1.maxAge - the max-age-av.wrapped - true if the value should be wrapped in DQUOTE as described in
cookie-value.secure - the secure-av.httpOnly - the httponly-av (see
HTTP-only).sameSite - the
SameSite attribute.public static HttpSetCookie parseSetCookie(CharSequence setCookieString, boolean validateContent)
setCookieString - The set-cookie-string
value.validateContent - true to make a best effort to validate the contents of the SetCookie.HttpSetCookie representation of setCookie.public CharSequence name()
HttpCookiePairHttpCookiePair.name in interface HttpCookiePairHttpCookiePairpublic CharSequence value()
HttpCookiePairHttpCookiePair.value in interface HttpCookiePairHttpCookiePairpublic boolean isWrapped()
HttpCookiePairtrue if the value should be wrapped in DQUOTE as described in
cookie-value.isWrapped in interface HttpCookiePairtrue if the value should be wrapped in DQUOTE as described in
cookie-value.@Nullable public CharSequence domain()
HttpSetCookieHttpSetCookie.domain in interface HttpSetCookieHttpSetCookie@Nullable public CharSequence path()
HttpSetCookieHttpSetCookie.path in interface HttpSetCookieHttpSetCookie's path@Nullable public Long maxAge()
HttpSetCookieHttpSetCookie in seconds if specified.maxAge in interface HttpSetCookieHttpSetCookie. null if none specified.@Nullable public CharSequence expires()
HttpSetCookieHttpSetCookie according
to Expires.expires in interface HttpSetCookieHttpSetCookie according
to Expires.@Nullable public HttpSetCookie.SameSite sameSite()
HttpSetCookiesameSite in interface HttpSetCookiepublic boolean isSecure()
HttpSetCookieHttpSetCookie is secure.isSecure in interface HttpSetCookieHttpSetCookie is secure, otherwise falsepublic boolean isHttpOnly()
HttpSetCookieHttpSetCookie can only be accessed via HTTP.
If this returns true, the HttpSetCookie cannot be accessed through
client side script - But only if the browser supports it.
For more information, please look hereisHttpOnly in interface HttpSetCookieHttpSetCookie is HTTP-only or false if it isn'tpublic CharSequence encoded()
HttpCookiePairHttpCookiePair.encoded in interface HttpCookiePairHttpCookiePair.public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object