Class StandardResponseCookie
Object
se.curity.identityserver.sdk.web.cookie.ResponseCookie
se.curity.identityserver.sdk.web.cookie.StandardResponseCookie
- All Implemented Interfaces:
Cookie
A Standard HTTP cookie.
Unlike ExpirableResponseCookie, standard cookies use the max-age attribute to decide
whether a cookie is persistent or not.
If max-age is set to a positive value, then the cookie is persistent and lasts for the amount of time given by max-age.
If max-age is set to 0, then the cookie is immediately expired.
If max-age is set to a negative value, or not set at all, then the cookie lasts until the browser session is ended.
- Since:
- 2.1.0
-
Constructor Summary
ConstructorsConstructorDescriptionStandardResponseCookie(String name, @Nullable String value) Create a cookie with the provided name and value.StandardResponseCookie(Cookie cookie) Create a copy of the provided cookie. -
Method Summary
Methods inherited from class se.curity.identityserver.sdk.web.cookie.ResponseCookie
getComment, getDomain, getName, getPath, getValue, getVersion, isHttpOnly, setComment, setDomain, setHttpOnly, setPath, setValue, setVersion
-
Constructor Details
-
StandardResponseCookie
Create a cookie with the provided name and value.- Parameters:
name- the name of the cookievalue- the value of the cookie
-
StandardResponseCookie
Create a copy of the provided cookie.- Parameters:
cookie- to be copied
-
-
Method Details
-
setMaxAge
Set the max-age of the cookie.If set to null, this cookie will last only until the browser session is ended.
- Parameters:
duration- of time the cookie should live for
-
getMaxAge
Get the max-age of the cookie.- Returns:
- the max-age of the cookie. If not present, then this cookie is a session cookie.
-