Class CookieSerializer.CookieValue

java.lang.Object
org.springframework.session.web.http.CookieSerializer.CookieValue
Enclosing interface:
CookieSerializer

public static class CookieSerializer.CookieValue extends Object
Contains the information necessary to write a value to the HttpServletResponse.
Since:
1.1
  • Constructor Details

    • CookieValue

      public CookieValue(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String cookieValue)
      Creates a new instance.
      Parameters:
      request - the HttpServletRequest to use. Useful for determining the context in which the cookie is set. Cannot be null.
      response - the HttpServletResponse to use.
      cookieValue - the value of the cookie to be written. This value may be modified by the CookieSerializer 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

      public String getCookieValue()
      The value to be written. This value may be modified by the CookieSerializer 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