Package io.undertow.server.handlers
Class CookieImpl
- java.lang.Object
-
- io.undertow.server.handlers.CookieImpl
-
- All Implemented Interfaces:
Cookie,Comparable
public class CookieImpl extends Object implements Cookie
- Author:
- Stuart Douglas, Richard Opalka
-
-
Field Summary
-
Fields inherited from interface io.undertow.server.handlers.Cookie
COOKIE_COMMENT_ATTR, COOKIE_DISCARD_ATTR, COOKIE_DOMAIN_ATTR, COOKIE_EXPIRES_ATTR, COOKIE_HTTP_ONLY_ATTR, COOKIE_MAX_AGE_ATTR, COOKIE_PATH_ATTR, COOKIE_SAME_SITE_ATTR, COOKIE_SECURE_ATTR
-
-
Constructor Summary
Constructors Constructor Description CookieImpl(String name)CookieImpl(String name, String value)CookieImpl(String name, String value, Cookie cookiePrimer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Object other)booleanequals(Object other)StringgetAttribute(String name)Returns the attribute associated with the name ornullif no attribute is associated with the name.Map<String,String>getAttributes()Returns an unmodifiable map of the attributes associated with this cookie.StringgetComment()StringgetDomain()DategetExpires()IntegergetMaxAge()StringgetName()StringgetPath()StringgetSameSiteMode()StringgetValue()intgetVersion()inthashCode()booleanisDiscard()booleanisHttpOnly()booleanisSameSite()booleanisSecure()CookiesetAttribute(String name, String value)Sets an attribute for the cookie.protected CookiesetAttribute(String name, String value, boolean performSync)CookiesetComment(String comment)CookieImplsetDiscard(boolean discard)CookieImplsetDomain(String domain)CookieImplsetExpires(Date expires)CookieImplsetHttpOnly(boolean httpOnly)CookieImplsetMaxAge(Integer maxAge)CookieImplsetPath(String path)CookiesetSameSite(boolean sameSite)CookiesetSameSiteMode(String mode)CookieImplsetSecure(boolean secure)CookieImplsetValue(String value)CookieImplsetVersion(int version)StringtoString()
-
-
-
Method Detail
-
setValue
public CookieImpl setValue(String value)
-
setPath
public CookieImpl setPath(String path)
-
setDomain
public CookieImpl setDomain(String domain)
-
setMaxAge
public CookieImpl setMaxAge(Integer maxAge)
-
setDiscard
public CookieImpl setDiscard(boolean discard)
- Specified by:
setDiscardin interfaceCookie
-
setSecure
public CookieImpl setSecure(boolean secure)
-
getVersion
public int getVersion()
- Specified by:
getVersionin interfaceCookie
-
setVersion
public CookieImpl setVersion(int version)
- Specified by:
setVersionin interfaceCookie
-
isHttpOnly
public boolean isHttpOnly()
- Specified by:
isHttpOnlyin interfaceCookie
-
setHttpOnly
public CookieImpl setHttpOnly(boolean httpOnly)
- Specified by:
setHttpOnlyin interfaceCookie
-
getExpires
public Date getExpires()
- Specified by:
getExpiresin interfaceCookie
-
setExpires
public CookieImpl setExpires(Date expires)
- Specified by:
setExpiresin interfaceCookie
-
getComment
public String getComment()
- Specified by:
getCommentin interfaceCookie
-
setComment
public Cookie setComment(String comment)
- Specified by:
setCommentin interfaceCookie
-
isSameSite
public boolean isSameSite()
- Specified by:
isSameSitein interfaceCookie
-
setSameSite
public Cookie setSameSite(boolean sameSite)
- Specified by:
setSameSitein interfaceCookie
-
getSameSiteMode
public String getSameSiteMode()
- Specified by:
getSameSiteModein interfaceCookie
-
setSameSiteMode
public Cookie setSameSiteMode(String mode)
- Specified by:
setSameSiteModein interfaceCookie
-
getAttribute
public String getAttribute(String name)
Description copied from interface:CookieReturns the attribute associated with the name ornullif no attribute is associated with the name.- Specified by:
getAttributein interfaceCookie- Parameters:
name- the name of the attribute- Returns:
- the value or
nullif not found
-
setAttribute
public Cookie setAttribute(String name, String value)
Description copied from interface:CookieSets 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.COOKIE_PATH_ATTR" it will override that value- Specified by:
setAttributein interfaceCookie- Parameters:
name- the name of the attributevalue- the value of the attribute ornullto remove it- Returns:
- this cookie
-
getAttributes
public Map<String,String> getAttributes()
Description copied from interface:CookieReturns an unmodifiable map of the attributes associated with this cookie.- Specified by:
getAttributesin interfaceCookie- Returns:
- an unmodifiable map of the attributes
-
compareTo
public final int compareTo(Object other)
- Specified by:
compareToin interfaceComparable- Specified by:
compareToin interfaceCookie
-
-