Package play.core.cookie.encoding
Interface Cookie
- All Superinterfaces:
Comparable<Cookie>
- All Known Implementing Classes:
DefaultCookie
An interface defining an HTTP cookie.
-
Method Summary
Modifier and TypeMethodDescriptiondomain()Returns the domain of thisCookie.booleanChecks to see if thisCookiecan only be accessed via HTTP.booleanChecks to see if thisCookieis partitionedbooleanisSecure()Checks to see if thisCookieis secureintmaxAge()Returns the maximum age of thisCookiein seconds orInteger.MIN_VALUEif unspecifiedname()Returns the name of thisCookie.path()Returns the path of thisCookie.sameSite()Returns the SameSite attribute of this cookie as a StringvoidSets the domain of thisCookie.voidsetHttpOnly(boolean httpOnly) Determines if thisCookieis HTTP only.voidsetMaxAge(int maxAge) Sets the maximum age of thisCookiein seconds.voidsetPartitioned(boolean partitioned) Sets thePartitionedattribute of thisCookievoidSets the path of thisCookie.voidsetSameSite(String sameSite) Sets the SameSite attribute of thisCookievoidsetSecure(boolean secure) Sets the secure attribute of thisCookievoidSets the value of thisCookie.voidsetWrap(boolean wrap) Sets true if the value of thisCookieis to be wrapped with double quotes.value()Returns the value of thisCookie.booleanwrap()Returns true if the raw value of thisCookie, was wrapped with double quotes in original Set-Cookie header.Methods inherited from interface java.lang.Comparable
compareTo
-
Method Details
-
name
String name()Returns the name of thisCookie.- Returns:
- The name of this
Cookie
-
value
String value()Returns the value of thisCookie.- Returns:
- The value of this
Cookie
-
setValue
Sets the value of thisCookie.- Parameters:
value- The value to set
-
wrap
boolean wrap()Returns true if the raw value of thisCookie, was wrapped with double quotes in original Set-Cookie header.- Returns:
- If the value of this
Cookieis to be wrapped
-
setWrap
void setWrap(boolean wrap) Sets true if the value of thisCookieis to be wrapped with double quotes.- Parameters:
wrap- true if wrap
-
domain
String domain()Returns the domain of thisCookie.- Returns:
- The domain of this
Cookie
-
setDomain
Sets the domain of thisCookie.- Parameters:
domain- The domain to use
-
path
String path()Returns the path of thisCookie.- Returns:
- The
Cookie's path
-
setPath
Sets the path of thisCookie.- Parameters:
path- The path to use for thisCookie
-
sameSite
String sameSite()Returns the SameSite attribute of this cookie as a String- Returns:
- The SameSite attribute of the cookie
-
setSameSite
Sets the SameSite attribute of thisCookie- Parameters:
sameSite- The SameSite attribute of the cookie
-
maxAge
int maxAge()Returns the maximum age of thisCookiein seconds orInteger.MIN_VALUEif unspecified- Returns:
- The maximum age of this
Cookie
-
setMaxAge
void setMaxAge(int maxAge) Sets the maximum age of thisCookiein seconds. If an age of0is specified, thisCookiewill be automatically removed by browser because it will expire immediately. IfInteger.MIN_VALUEis specified, thisCookiewill be removed when the browser is closed.- Parameters:
maxAge- The maximum age of thisCookiein seconds
-
isSecure
boolean isSecure()Checks to see if thisCookieis secure- Returns:
- True if this
Cookieis secure, otherwise false
-
setSecure
void setSecure(boolean secure) Sets the secure attribute of thisCookie- Parameters:
secure- True if thisCookieis to be secure, otherwise false
-
isHttpOnly
boolean isHttpOnly()Checks to see if thisCookiecan only be accessed via HTTP. If this returns true, theCookiecannot be accessed through client side script - But only if the browser supports it. For more information, please look here- Returns:
- True if this
Cookieis HTTP-only or false if it isn't
-
setHttpOnly
void setHttpOnly(boolean httpOnly) Determines if thisCookieis HTTP only. If set to true, thisCookiecannot be accessed by a client side script. However, this works only if the browser supports it. For for information, please look here.- Parameters:
httpOnly- True if theCookieis HTTP only, otherwise false.
-
isPartitioned
boolean isPartitioned()Checks to see if thisCookieis partitioned- Returns:
- True if this
Cookieis partitioned, otherwise false
-
setPartitioned
void setPartitioned(boolean partitioned) Sets thePartitionedattribute of thisCookie- Parameters:
partitioned- True if thisCookieis to be partitioned, otherwise false
-