Package org.spincast.core.cookies
Interface Cookie
- All Known Implementing Classes:
CookieDefault
public interface Cookie
An HTTP cookie.
-
Method Summary
Modifier and TypeMethodDescriptionGets the cookie domain.Gets the date the cookie will expire at.getName()Gets the cookie name.getPath()Gets the cookie path.The "sameSite" attribute.getValue()Gets the cookie value.intGets the cookie version.booleanIs this cookie to be discarded?booleanIs this cookie expired?booleanIs the cookie availableto the server and not to javascript?booleanisSecure()Is the "secure" feature on?voidSets the cookie domain.voidsetExpires(Date expires) Sets the date the cookie will expire.voidsetExpiresUsingMaxAge(int maxAge) Sets the number of seconds for a cookie to live.voidsetHttpOnly(boolean httpOnly) Sets if the cookie is available only for to the server anbd not to javascript.voidSets the cookie path.voidsetSameSite(CookieSameSite sameSite) The "sameSite" attribute to add.voidsetSecure(boolean secure) Sets the "secure" feature on or off.voidSets the cookie value.
-
Method Details
-
getName
String getName()Gets the cookie name. -
getValue
String getValue()Gets the cookie value. -
setValue
Sets the cookie value. -
getPath
String getPath()Gets the cookie path. -
setPath
Sets the cookie path. -
getDomain
String getDomain()Gets the cookie domain. -
setDomain
Sets the cookie domain. -
getExpires
Date getExpires()Gets the date the cookie will expire at. If the date is in the past, the cookie will be deleted. Ifnullthe cookie will live for the current session (this is the default). -
setExpires
Sets the date the cookie will expire. If the date is in the past, the cookie will be deleted. Ifnullthe cookie will live for the current session (this is the default). -
setExpiresUsingMaxAge
void setExpiresUsingMaxAge(int maxAge) Sets the number of seconds for a cookie to live. IfmaxAge< 0 : The "Expires date" will be in the past and the cookie will therefore be deleted. IfmaxAge== 0 : The "Expires date" will benulland the cookie will live for the session only. IfmaxAge> 0 : The "Expires date" will be the current date +'maxAge'seconds. -
isExpired
boolean isExpired()Is this cookie expired? -
isSecure
boolean isSecure()Is the "secure" feature on? -
setSecure
void setSecure(boolean secure) Sets the "secure" feature on or off. -
isHttpOnly
boolean isHttpOnly()Is the cookie availableto the server and not to javascript? -
setHttpOnly
void setHttpOnly(boolean httpOnly) Sets if the cookie is available only for to the server anbd not to javascript. -
getSameSite
CookieSameSite getSameSite()The "sameSite" attribute. May benullto not add it at all. -
setSameSite
The "sameSite" attribute to add. -
isDiscard
boolean isDiscard()Is this cookie to be discarded? -
getVersion
int getVersion()Gets the cookie version.
-