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.int
Gets the cookie version.boolean
Is this cookie to be discarded?boolean
Is this cookie expired?boolean
Is the cookie availableto the server and not to javascript?boolean
isSecure()
Is the "secure" feature on?void
Sets the cookie domain.void
setExpires
(Date expires) Sets the date the cookie will expire.void
setExpiresUsingMaxAge
(int maxAge) Sets the number of seconds for a cookie to live.void
setHttpOnly
(boolean httpOnly) Sets if the cookie is available only for to the server anbd not to javascript.void
Sets the cookie path.void
setSameSite
(CookieSameSite sameSite) The "sameSite" attribute to add.void
setSecure
(boolean secure) Sets the "secure" feature on or off.void
Sets 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. Ifnull
the 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. Ifnull
the 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 benull
and 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 benull
to 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.
-