Package org.eclipse.jetty.http
Class HttpCookie
java.lang.Object
org.eclipse.jetty.http.HttpCookie
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
String used in theComment
attribute ofHttpCookie
, parsed withisHttpOnlyInComment(String)
, to support theHttpOnly
attribute.static final String
String used in theComment
attribute ofHttpCookie
, parsed withisPartitionedInComment(String)
, to support thePartitioned
attribute.static final String
Name of context attribute with default SameSite cookie valuestatic final String
static final String
static final String
-
Constructor Summary
ConstructorDescriptionHttpCookie
(String setCookie) HttpCookie
(String name, String value) HttpCookie
(String name, String value, long maxAge) HttpCookie
(String name, String value, String domain, String path) HttpCookie
(String name, String value, String domain, String path, long maxAge, boolean httpOnly, boolean secure) HttpCookie
(String name, String value, String domain, String path, long maxAge, boolean httpOnly, boolean secure, String comment, int version) HttpCookie
(String name, String value, String domain, String path, long maxAge, boolean httpOnly, boolean secure, String comment, int version, HttpCookie.SameSite sameSite) HttpCookie
(String name, String value, String domain, String path, long maxAge, boolean httpOnly, boolean secure, String comment, int version, HttpCookie.SameSite sameSite, boolean partitioned) -
Method Summary
Modifier and TypeMethodDescriptionasString()
static String
getCommentWithAttributes
(String comment, boolean httpOnly, HttpCookie.SameSite sameSite) static String
getCommentWithAttributes
(String comment, boolean httpOnly, HttpCookie.SameSite sameSite, boolean partitioned) static String
getCommentWithoutAttributes
(String comment) long
getName()
getPath()
static HttpCookie.SameSite
getSameSiteDefault
(Attributes contextAttributes) Get the default value for SameSite cookie attribute, if one has been set for the given context.static HttpCookie.SameSite
getSameSiteFromComment
(String comment) getSetCookie
(CookieCompliance compliance) getValue()
int
boolean
isExpired
(long timeNanos) boolean
static boolean
isHttpOnlyInComment
(String comment) boolean
static boolean
isPartitionedInComment
(String comment) boolean
isSecure()
-
Field Details
-
HTTP_ONLY_COMMENT
String used in theComment
attribute ofHttpCookie
, parsed withisHttpOnlyInComment(String)
, to support theHttpOnly
attribute.- See Also:
-
PARTITIONED_COMMENT
String used in theComment
attribute ofHttpCookie
, parsed withisPartitionedInComment(String)
, to support thePartitioned
attribute.- See Also:
-
SAME_SITE_NONE_COMMENT
- See Also:
-
SAME_SITE_LAX_COMMENT
- See Also:
-
SAME_SITE_STRICT_COMMENT
- See Also:
-
SAME_SITE_DEFAULT_ATTRIBUTE
Name of context attribute with default SameSite cookie value- See Also:
-
-
Constructor Details
-
HttpCookie
-
HttpCookie
-
HttpCookie
-
HttpCookie
-
HttpCookie
-
HttpCookie
-
HttpCookie
-
HttpCookie
-
-
Method Details
-
getName
- Returns:
- the cookie name
-
getValue
- Returns:
- the cookie value
-
getComment
- Returns:
- the cookie comment
-
getDomain
- Returns:
- the cookie domain
-
getMaxAge
public long getMaxAge()- Returns:
- the cookie max age in seconds
-
getPath
- Returns:
- the cookie path
-
isSecure
public boolean isSecure()- Returns:
- whether the cookie is valid for secure domains
-
getVersion
public int getVersion()- Returns:
- the cookie version
-
getSameSite
- Returns:
- the cookie SameSite enum attribute
-
isHttpOnly
public boolean isHttpOnly()- Returns:
- whether the cookie is valid for the http protocol only
-
isExpired
public boolean isExpired(long timeNanos) - Parameters:
timeNanos
- the time to check for cookie expiration, in nanoseconds- Returns:
- whether the cookie is expired by the given time
-
isPartitioned
public boolean isPartitioned()- Returns:
- whether this cookie is partitioned
-
asString
- Returns:
- a string representation of this cookie
-
getSetCookie
-
getRFC2965SetCookie
-
getRFC6265SetCookie
-
isHttpOnlyInComment
-
isPartitionedInComment
-
getSameSiteFromComment
-
getSameSiteDefault
Get the default value for SameSite cookie attribute, if one has been set for the given context.- Parameters:
contextAttributes
- the context to check for default SameSite value- Returns:
- the default SameSite value or null if one does not exist
- Throws:
IllegalStateException
- if the default value is not a permitted value
-
getCommentWithoutAttributes
-
getCommentWithAttributes
public static String getCommentWithAttributes(String comment, boolean httpOnly, HttpCookie.SameSite sameSite) -
getCommentWithAttributes
public static String getCommentWithAttributes(String comment, boolean httpOnly, HttpCookie.SameSite sameSite, boolean partitioned)
-