Class SimpleCookie
java.lang.Object
org.apache.shiro.web.servlet.SimpleCookie
- All Implemented Interfaces:
Cookie
Default
Cookie implementation. 'HttpOnly' is supported out of the box, even on
Servlet 2.4 and 2.5 container implementations, using raw header writing logic and not
javax.servlet.http.Cookie objects (which only has 'HttpOnly' support in Servlet
2.6 specifications and above).- Since:
- 1.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.shiro.web.servlet.Cookie
Cookie.SameSiteOptions -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final longstatic final int-1, indicating the cookie should expire when the browser closes.static final int-1indicating that no version property should be set on the cookie.protected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final StringFields inherited from interface org.apache.shiro.web.servlet.Cookie
DELETED_COOKIE_VALUE, ONE_YEAR, ROOT_PATH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringbuildHeaderValue(String name, String value, String comment, String domain, String path, int maxAge, int version, boolean secure, boolean httpOnly) protected StringbuildHeaderValue(String name, String value, String comment, String domain, String path, int maxAge, int version, boolean secure, boolean httpOnly, Cookie.SameSiteOptions sameSite) intgetName()getPath()getValue()intbooleanbooleanisSecure()readValue(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse ignored) voidremoveFrom(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) voidsaveTo(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) voidsetComment(String comment) voidvoidsetHttpOnly(boolean httpOnly) voidsetMaxAge(int maxAge) voidvoidvoidsetSameSite(Cookie.SameSiteOptions sameSite) voidsetSecure(boolean secure) voidvoidsetVersion(int version)
-
Field Details
-
DEFAULT_MAX_AGE
-1, indicating the cookie should expire when the browser closes.- See Also:
-
DEFAULT_VERSION
-1indicating that no version property should be set on the cookie.- See Also:
-
NAME_VALUE_DELIMITER
- See Also:
-
ATTRIBUTE_DELIMITER
- See Also:
-
DAY_MILLIS
- See Also:
-
GMT_TIME_ZONE_ID
- See Also:
-
COOKIE_DATE_FORMAT_STRING
- See Also:
-
COOKIE_HEADER_NAME
- See Also:
-
PATH_ATTRIBUTE_NAME
- See Also:
-
EXPIRES_ATTRIBUTE_NAME
- See Also:
-
MAXAGE_ATTRIBUTE_NAME
- See Also:
-
DOMAIN_ATTRIBUTE_NAME
- See Also:
-
VERSION_ATTRIBUTE_NAME
- See Also:
-
COMMENT_ATTRIBUTE_NAME
- See Also:
-
SECURE_ATTRIBUTE_NAME
- See Also:
-
HTTP_ONLY_ATTRIBUTE_NAME
- See Also:
-
SAME_SITE_ATTRIBUTE_NAME
- See Also:
-
-
Constructor Details
-
SimpleCookie
public SimpleCookie() -
SimpleCookie
-
SimpleCookie
-
-
Method Details
-
getName
-
setName
-
getValue
-
setValue
-
getComment
- Specified by:
getCommentin interfaceCookie
-
setComment
- Specified by:
setCommentin interfaceCookie
-
getDomain
-
setDomain
-
getPath
-
setPath
-
getMaxAge
-
setMaxAge
-
getVersion
- Specified by:
getVersionin interfaceCookie
-
setVersion
- Specified by:
setVersionin interfaceCookie
-
isSecure
-
setSecure
-
isHttpOnly
- Specified by:
isHttpOnlyin interfaceCookie
-
setHttpOnly
- Specified by:
setHttpOnlyin interfaceCookie
-
getSameSite
- Specified by:
getSameSitein interfaceCookie
-
setSameSite
- Specified by:
setSameSitein interfaceCookie
-
saveTo
-
buildHeaderValue
-
buildHeaderValue
protected String buildHeaderValue(String name, String value, String comment, String domain, String path, int maxAge, int version, boolean secure, boolean httpOnly, Cookie.SameSiteOptions sameSite) -
removeFrom
public void removeFrom(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) - Specified by:
removeFromin interfaceCookie
-
readValue
-