Package org.springframework.web.util
Class CookieGenerator
java.lang.Object
org.springframework.web.util.CookieGenerator
- Direct Known Subclasses:
CookieThemeResolver
Deprecated, for removal: This API element is subject to removal in a future version.
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.
- Since:
- 1.1.4
- Author:
- Juergen Hoeller
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Deprecated, for removal: This API element is subject to removal in a future version.Default path that cookies will be visible to: "/", i.e.protected final org.apache.commons.logging.Log
Deprecated, for removal: This API element is subject to removal in a future version. -
Constructor Summary
ConstructorDescriptionDeprecated, for removal: This API element is subject to removal in a future version. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCookie
(HttpServletResponse response, String cookieValue) Deprecated, for removal: This API element is subject to removal in a future version.Add a cookie with the given value to the response, using the cookie descriptor settings of this generator.protected Cookie
createCookie
(String cookieValue) Deprecated, for removal: This API element is subject to removal in a future version.Create a cookie with the given value, using the cookie descriptor settings of this generator (except for "cookieMaxAge").Deprecated, for removal: This API element is subject to removal in a future version.Return the domain for cookies created by this generator, if any.Deprecated, for removal: This API element is subject to removal in a future version.Return the maximum age for cookies created by this generator.Deprecated, for removal: This API element is subject to removal in a future version.Return the given name for cookies created by this generator.Deprecated, for removal: This API element is subject to removal in a future version.Return the path for cookies created by this generator.boolean
Deprecated, for removal: This API element is subject to removal in a future version.Return whether the cookie is supposed to be marked with the "HttpOnly" attribute.boolean
Deprecated, for removal: This API element is subject to removal in a future version.Return whether the cookie should only be sent using a secure protocol, such as HTTPS (SSL).void
removeCookie
(HttpServletResponse response) Deprecated, for removal: This API element is subject to removal in a future version.Remove the cookie that this generator describes from the response.void
setCookieDomain
(@Nullable String cookieDomain) Deprecated, for removal: This API element is subject to removal in a future version.Use the given domain for cookies created by this generator.void
setCookieHttpOnly
(boolean cookieHttpOnly) Deprecated, for removal: This API element is subject to removal in a future version.Set whether the cookie is supposed to be marked with the "HttpOnly" attribute.void
setCookieMaxAge
(@Nullable Integer cookieMaxAge) Deprecated, for removal: This API element is subject to removal in a future version.Use the given maximum age (in seconds) for cookies created by this generator.void
setCookieName
(@Nullable String cookieName) Deprecated, for removal: This API element is subject to removal in a future version.Use the given name for cookies created by this generator.void
setCookiePath
(String cookiePath) Deprecated, for removal: This API element is subject to removal in a future version.Use the given path for cookies created by this generator.void
setCookieSecure
(boolean cookieSecure) Deprecated, for removal: This API element is subject to removal in a future version.Set whether the cookie should only be sent using a secure protocol, such as HTTPS (SSL).
-
Field Details
-
DEFAULT_COOKIE_PATH
Deprecated, for removal: This API element is subject to removal in a future version.Default path that cookies will be visible to: "/", i.e. the entire server.- See Also:
-
logger
protected final org.apache.commons.logging.Log loggerDeprecated, for removal: This API element is subject to removal in a future version.
-
-
Constructor Details
-
CookieGenerator
public CookieGenerator()Deprecated, for removal: This API element is subject to removal in a future version.
-
-
Method Details
-
setCookieName
Deprecated, for removal: This API element is subject to removal in a future version.Use the given name for cookies created by this generator.- See Also:
-
getCookieName
Deprecated, for removal: This API element is subject to removal in a future version.Return the given name for cookies created by this generator. -
setCookieDomain
Deprecated, for removal: This API element is subject to removal in a future version.Use the given domain for cookies created by this generator. The cookie is only visible to servers in this domain.- See Also:
-
getCookieDomain
Deprecated, for removal: This API element is subject to removal in a future version.Return the domain for cookies created by this generator, if any. -
setCookiePath
Deprecated, for removal: This API element is subject to removal in a future version.Use the given path for cookies created by this generator. The cookie is only visible to URLs in this path and below.- See Also:
-
getCookiePath
Deprecated, for removal: This API element is subject to removal in a future version.Return the path for cookies created by this generator. -
setCookieMaxAge
Deprecated, for removal: This API element is subject to removal in a future version.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.
- See Also:
-
getCookieMaxAge
Deprecated, for removal: This API element is subject to removal in a future version.Return the maximum age for cookies created by this generator. -
setCookieSecure
public void setCookieSecure(boolean cookieSecure) Deprecated, for removal: This API element is subject to removal in a future version.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".
- See Also:
-
isCookieSecure
public boolean isCookieSecure()Deprecated, for removal: This API element is subject to removal in a future version.Return whether the cookie should only be sent using a secure protocol, such as HTTPS (SSL). -
setCookieHttpOnly
public void setCookieHttpOnly(boolean cookieHttpOnly) Deprecated, for removal: This API element is subject to removal in a future version.Set whether the cookie is supposed to be marked with the "HttpOnly" attribute.Default is "false".
- See Also:
-
isCookieHttpOnly
public boolean isCookieHttpOnly()Deprecated, for removal: This API element is subject to removal in a future version.Return whether the cookie is supposed to be marked with the "HttpOnly" attribute. -
addCookie
Deprecated, for removal: This API element is subject to removal in a future version.Add a cookie with the given value to the response, using the cookie descriptor settings of this generator.Delegates to
createCookie(java.lang.String)
for cookie creation.- Parameters:
response
- the HTTP response to add the cookie tocookieValue
- the value of the cookie to add- See Also:
-
removeCookie
Deprecated, for removal: This API element is subject to removal in a future version.Remove the cookie that this generator describes from the response. Will generate a cookie with empty value and max age 0.Delegates to
createCookie(java.lang.String)
for cookie creation.- Parameters:
response
- the HTTP response to remove the cookie from- See Also:
-
createCookie
Deprecated, for removal: This API element is subject to removal in a future version.Create a cookie with the given value, using the cookie descriptor settings of this generator (except for "cookieMaxAge").- Parameters:
cookieValue
- the value of the cookie to crate- Returns:
- the cookie
- See Also:
-
ResponseCookie
for removal in 7.1