Package io.servicetalk.http.api
Class DefaultHttpSetCookie
java.lang.Object
io.servicetalk.http.api.DefaultHttpSetCookie
- All Implemented Interfaces:
HttpCookiePair
,HttpSetCookie
Default implementation of
HttpSetCookie
.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.servicetalk.http.api.HttpSetCookie
HttpSetCookie.SameSite
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultHttpSetCookie
(CharSequence name, CharSequence value) Create a new not wrapped, not secure and not HTTP-onlyHttpSetCookie
instance, with no path, domain, expire date and maximum age.DefaultHttpSetCookie
(CharSequence name, CharSequence value, boolean wrapped, boolean secure, boolean httpOnly) Create a newHttpSetCookie
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 newHttpSetCookie
instance. -
Method Summary
Modifier and TypeMethodDescriptiondomain()
Returns the domain of thisHttpSetCookie
.encoded()
Get the encoded value of thisHttpCookiePair
.boolean
expires()
Returns the expire date of thisHttpSetCookie
according to Expires.int
hashCode()
boolean
Checks to see if thisHttpSetCookie
can only be accessed via HTTP.boolean
isSecure()
Checks to see if thisHttpSetCookie
is secure.boolean
Returnstrue
if the value should be wrapped in DQUOTE as described in cookie-value.maxAge()
Returns the maximum age of thisHttpSetCookie
in seconds if specified.name()
Returns the name of thisHttpCookiePair
.static HttpSetCookie
parseSetCookie
(CharSequence setCookieString, boolean validateContent) path()
Returns the path of thisHttpSetCookie
.sameSite()
Get the value for the SameSite attribute.toString()
value()
Returns the value of thisHttpCookiePair
.
-
Constructor Details
-
DefaultHttpSetCookie
Create a new not wrapped, not secure and not HTTP-onlyHttpSetCookie
instance, with no path, domain, expire date and maximum age.- Parameters:
name
- the cookie-name.value
- the cookie-value.
-
DefaultHttpSetCookie
public DefaultHttpSetCookie(CharSequence name, CharSequence value, boolean wrapped, boolean secure, boolean httpOnly) Create a newHttpSetCookie
instance, with no path, domain, expire date and maximum age.- Parameters:
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).
-
DefaultHttpSetCookie
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) Creates a newHttpSetCookie
instance.- Parameters:
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.
-
-
Method Details
-
parseSetCookie
- Parameters:
setCookieString
- The set-cookie-string value.validateContent
-true
to make a best effort to validate the contents of the SetCookie.- Returns:
- a
HttpSetCookie
representation ofsetCookie
.
-
name
Description copied from interface:HttpCookiePair
Returns the name of thisHttpCookiePair
.- Specified by:
name
in interfaceHttpCookiePair
- Returns:
- The name of this
HttpCookiePair
-
value
Description copied from interface:HttpCookiePair
Returns the value of thisHttpCookiePair
.- Specified by:
value
in interfaceHttpCookiePair
- Returns:
- The value of this
HttpCookiePair
-
isWrapped
public boolean isWrapped()Description copied from interface:HttpCookiePair
Returnstrue
if the value should be wrapped in DQUOTE as described in cookie-value.- Specified by:
isWrapped
in interfaceHttpCookiePair
- Returns:
true
if the value should be wrapped in DQUOTE as described in cookie-value.
-
domain
Description copied from interface:HttpSetCookie
Returns the domain of thisHttpSetCookie
.- Specified by:
domain
in interfaceHttpSetCookie
- Returns:
- The domain of this
HttpSetCookie
-
path
Description copied from interface:HttpSetCookie
Returns the path of thisHttpSetCookie
.- Specified by:
path
in interfaceHttpSetCookie
- Returns:
- The
HttpSetCookie
's path
-
maxAge
Description copied from interface:HttpSetCookie
Returns the maximum age of thisHttpSetCookie
in seconds if specified.- Specified by:
maxAge
in interfaceHttpSetCookie
- Returns:
- The maximum age of this
HttpSetCookie
.null
if none specified.
-
expires
Description copied from interface:HttpSetCookie
Returns the expire date of thisHttpSetCookie
according to Expires.- Specified by:
expires
in interfaceHttpSetCookie
- Returns:
- the expire date of this
HttpSetCookie
according to Expires.
-
sameSite
Description copied from interface:HttpSetCookie
Get the value for the SameSite attribute.- Specified by:
sameSite
in interfaceHttpSetCookie
- Returns:
- The value for the SameSite attribute.
-
isSecure
public boolean isSecure()Description copied from interface:HttpSetCookie
Checks to see if thisHttpSetCookie
is secure.- Specified by:
isSecure
in interfaceHttpSetCookie
- Returns:
- True if this
HttpSetCookie
is secure, otherwise false
-
isHttpOnly
public boolean isHttpOnly()Description copied from interface:HttpSetCookie
Checks to see if thisHttpSetCookie
can only be accessed via HTTP. If this returns true, theHttpSetCookie
cannot be accessed through client side script - But only if the browser supports it. For more information, please look here- Specified by:
isHttpOnly
in interfaceHttpSetCookie
- Returns:
- True if this
HttpSetCookie
is HTTP-only or false if it isn't
-
encoded
Description copied from interface:HttpCookiePair
Get the encoded value of thisHttpCookiePair
.- Specified by:
encoded
in interfaceHttpCookiePair
- Returns:
- the encoded value of this
HttpCookiePair
.
-
equals
-
hashCode
public int hashCode() -
toString
-