Class CookieSerializer.CookieValue
java.lang.Object
org.springframework.session.web.http.CookieSerializer.CookieValue
- Enclosing interface:
- CookieSerializer
Contains the information necessary to write a value to the
HttpServletResponse
.- Since:
- 1.1
-
Constructor Summary
ConstructorDescriptionCookieValue
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String cookieValue) Creates a new instance. -
Method Summary
Modifier and TypeMethodDescriptionint
Get the cookie max age.The value to be written.javax.servlet.http.HttpServletRequest
Gets the request to use.javax.servlet.http.HttpServletResponse
Gets the response to write to.void
setCookieMaxAge
(int cookieMaxAge) Set the cookie max age.
-
Constructor Details
-
CookieValue
public CookieValue(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String cookieValue) Creates a new instance.- Parameters:
request
- theHttpServletRequest
to use. Useful for determining the context in which the cookie is set. Cannot be null.response
- theHttpServletResponse
to use.cookieValue
- the value of the cookie to be written. This value may be modified by theCookieSerializer
when writing to the actual cookie so long as the original value is returned when the cookie is read.
-
-
Method Details
-
getRequest
public javax.servlet.http.HttpServletRequest getRequest()Gets the request to use.- Returns:
- the request to use. Cannot be null.
-
getResponse
public javax.servlet.http.HttpServletResponse getResponse()Gets the response to write to.- Returns:
- the response to write to. Cannot be null.
-
getCookieValue
The value to be written. This value may be modified by theCookieSerializer
before written to the cookie. However, the value must be the same as the original when it is read back in.- Returns:
- the value to be written
-
getCookieMaxAge
public int getCookieMaxAge()Get the cookie max age. The default is -1 which signals to delete the cookie when the browser is closed, or 0 if cookie value is empty.- Returns:
- the cookie max age
-
setCookieMaxAge
public void setCookieMaxAge(int cookieMaxAge) Set the cookie max age.- Parameters:
cookieMaxAge
- the cookie max age
-