open class CookieGenerator
Helper class for cookie generation, carrying cookie descriptor settings as bean properties and being able to add and remove cookie to/from a given response.
Can serve as base class for components that generate specific cookies, such as CookieLocaleResolver and CookieThemeResolver.
Author
Juergen Hoeller
Since
1.1.4
See Also
#addCookie#removeCookieorg.springframework.web.servlet.i18n.CookieLocaleResolverorg.springframework.web.servlet.theme.CookieThemeResolver
CookieGenerator()
Helper class for cookie generation, carrying cookie descriptor settings as bean properties and being able to add and remove cookie to/from a given response. Can serve as base class for components that generate specific cookies, such as CookieLocaleResolver and CookieThemeResolver. |
static val DEFAULT_COOKIE_PATH: String
Default path that cookies will be visible to: "/", i.e. the entire server. |
open fun addCookie(response: HttpServletResponse, cookieValue: String): Unit
Add a cookie with the given value to the response, using the cookie descriptor settings of this generator. Delegates to |
|
open fun getCookieDomain(): String
Return the domain for cookies created by this generator, if any. |
|
open fun getCookieMaxAge(): Int
Return the maximum age for cookies created by this generator. |
|
open fun getCookieName(): String
Return the given name for cookies created by this generator. |
|
open fun getCookiePath(): String
Return the path for cookies created by this generator. |
|
open fun isCookieHttpOnly(): Boolean
Return whether the cookie is supposed to be marked with the "HttpOnly" attribute. |
|
open fun isCookieSecure(): Boolean
Return whether the cookie should only be sent using a secure protocol, such as HTTPS (SSL). |
|
open fun removeCookie(response: HttpServletResponse): Unit
Remove the cookie that this generator describes from the response. Will generate a cookie with empty value and max age 0. Delegates to |
|
open fun setCookieDomain(cookieDomain: String): Unit
Use the given domain for cookies created by this generator. The cookie is only visible to servers in this domain. |
|
open fun setCookieHttpOnly(cookieHttpOnly: Boolean): Unit
Set whether the cookie is supposed to be marked with the "HttpOnly" attribute. Default is "false". |
|
open fun setCookieMaxAge(cookieMaxAge: Int): Unit
Use the given maximum age (in seconds) for cookies created by this generator. Useful special value: -1 ... not persistent, deleted when client shuts down. Default is no specific maximum age at all, using the Servlet container's default. |
|
open fun setCookieName(cookieName: String): Unit
Use the given name for cookies created by this generator. |
|
open fun setCookiePath(cookiePath: String): Unit
Use the given path for cookies created by this generator. The cookie is only visible to URLs in this path and below. |
|
open fun setCookieSecure(cookieSecure: Boolean): Unit
Set whether the cookie should only be sent using a secure protocol, such as HTTPS (SSL). This is an indication to the receiving browser, not processed by the HTTP server itself. Default is "false". |
open class CookieLocaleResolver : CookieGenerator, LocaleContextResolver
LocaleResolver implementation that uses a cookie sent back to the user in case of a custom setting, with a fallback to the specified default locale or the request's accept-header locale. This is particularly useful for stateless applications without user sessions. The cookie may optionally contain an associated time zone value as well; alternatively, you may specify a default time zone. Custom controllers can override the user's locale and time zone by calling |
|
open class CookieThemeResolver : CookieGenerator, ThemeResolver
ThemeResolver implementation that uses a cookie sent back to the user in case of a custom setting, with a fallback to the default theme. This is particularly useful for stateless applications without user sessions. Custom controllers can thus override the user's theme by calling |