Package io.undertow.server.handlers
Interface Cookie
-
- All Superinterfaces:
Comparable
- All Known Implementing Classes:
CookieImpl
public interface Cookie extends Comparable
A HTTP cookie.- Author:
- Stuart Douglas
- See Also:
Connectors
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOOKIE_COMMENT_ATTRstatic StringCOOKIE_DISCARD_ATTRstatic StringCOOKIE_DOMAIN_ATTRstatic StringCOOKIE_EXPIRES_ATTRstatic StringCOOKIE_HTTP_ONLY_ATTRstatic StringCOOKIE_MAX_AGE_ATTRstatic StringCOOKIE_PATH_ATTRstatic StringCOOKIE_SAME_SITE_ATTRstatic StringCOOKIE_SECURE_ATTR
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default intcompareTo(Object other)default StringgetAttribute(String name)Returns the attribute associated with the name ornullif no attribute is associated with the name.default Map<String,String>getAttributes()Returns an unmodifiable map of the attributes associated with this cookie.StringgetComment()StringgetDomain()DategetExpires()IntegergetMaxAge()StringgetName()StringgetPath()default StringgetSameSiteMode()StringgetValue()intgetVersion()booleanisDiscard()booleanisHttpOnly()default booleanisSameSite()booleanisSecure()default CookiesetAttribute(String name, String value)Sets an attribute for the cookie.CookiesetComment(String comment)CookiesetDiscard(boolean discard)CookiesetDomain(String domain)CookiesetExpires(Date expires)CookiesetHttpOnly(boolean httpOnly)CookiesetMaxAge(Integer maxAge)CookiesetPath(String path)default CookiesetSameSite(boolean sameSite)Deprecated, for removal: This API element is subject to removal in a future version.default CookiesetSameSiteMode(String mode)CookiesetSecure(boolean secure)CookiesetValue(String value)CookiesetVersion(int version)
-
-
-
Field Detail
-
COOKIE_COMMENT_ATTR
static final String COOKIE_COMMENT_ATTR
- See Also:
- Constant Field Values
-
COOKIE_DOMAIN_ATTR
static final String COOKIE_DOMAIN_ATTR
- See Also:
- Constant Field Values
-
COOKIE_MAX_AGE_ATTR
static final String COOKIE_MAX_AGE_ATTR
- See Also:
- Constant Field Values
-
COOKIE_PATH_ATTR
static final String COOKIE_PATH_ATTR
- See Also:
- Constant Field Values
-
COOKIE_SECURE_ATTR
static final String COOKIE_SECURE_ATTR
- See Also:
- Constant Field Values
-
COOKIE_HTTP_ONLY_ATTR
static final String COOKIE_HTTP_ONLY_ATTR
- See Also:
- Constant Field Values
-
COOKIE_SAME_SITE_ATTR
static final String COOKIE_SAME_SITE_ATTR
- See Also:
- Constant Field Values
-
COOKIE_DISCARD_ATTR
static final String COOKIE_DISCARD_ATTR
- See Also:
- Constant Field Values
-
COOKIE_EXPIRES_ATTR
static final String COOKIE_EXPIRES_ATTR
- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
String getName()
-
getValue
String getValue()
-
getPath
String getPath()
-
getDomain
String getDomain()
-
getMaxAge
Integer getMaxAge()
-
isDiscard
boolean isDiscard()
-
setDiscard
Cookie setDiscard(boolean discard)
-
isSecure
boolean isSecure()
-
setSecure
Cookie setSecure(boolean secure)
-
getVersion
int getVersion()
-
setVersion
Cookie setVersion(int version)
-
isHttpOnly
boolean isHttpOnly()
-
setHttpOnly
Cookie setHttpOnly(boolean httpOnly)
-
getExpires
Date getExpires()
-
getComment
String getComment()
-
isSameSite
default boolean isSameSite()
-
setSameSite
@Deprecated(forRemoval=true) default Cookie setSameSite(boolean sameSite)
Deprecated, for removal: This API element is subject to removal in a future version.
-
getSameSiteMode
default String getSameSiteMode()
-
getAttribute
default String getAttribute(String name)
Returns the attribute associated with the name ornullif no attribute is associated with the name.- Parameters:
name- the name of the attribute- Returns:
- the value or
nullif not found
-
setAttribute
default Cookie setAttribute(String name, String value)
Sets an attribute for the cookie. If the value isnull, the attribute is removed. If the value is notnull, the attribute is added to the attributes for this cookie. If name match pre-existing attribute, like "COOKIE_PATH_ATTR" it will override that value- Parameters:
name- the name of the attributevalue- the value of the attribute ornullto remove it- Returns:
- this cookie
-
getAttributes
default Map<String,String> getAttributes()
Returns an unmodifiable map of the attributes associated with this cookie.- Returns:
- an unmodifiable map of the attributes
-
compareTo
default int compareTo(Object other)
- Specified by:
compareToin interfaceComparable
-
-