Class CookieManager

java.lang.Object
org.craftercms.commons.http.CookieManager

public class CookieManager extends Object
Utility class to create and delete cookies with common domain, path and max age.
Author:
avasquez
  • Field Details

  • Constructor Details

    • CookieManager

      public CookieManager()
  • Method Details

    • setDomain

      public void setDomain(String domain)
    • setPath

      public void setPath(String path)
    • setMaxAge

      public void setMaxAge(Integer maxAge)
    • setHttpOnly

      public void setHttpOnly(boolean httpOnly)
    • setSecure

      public void setSecure(boolean secure)
    • addCookie

      public void addCookie(String name, String value, javax.servlet.http.HttpServletResponse response)
      Add a new cookie, using the configured domain, path and max age, to the response.
      Parameters:
      name - the name of the cookie
      value - the value of the cookie
    • deleteCookie

      public void deleteCookie(String name, javax.servlet.http.HttpServletResponse response)
      Add a "delete" cookie to the response to indicate the that the stored cookie should be deleted.
      Parameters:
      name - the name of the cookie