Class CookieHandler

java.lang.Object
org.bardframework.commons.web.cookie.CookieHandler

public class CookieHandler extends Object
  • Constructor Details

    • CookieHandler

      public CookieHandler(String name)
      Default path that cookies will be visible to: "/", i.e. the entire server.
    • CookieHandler

      public CookieHandler(String name, String path)
  • Method Details

    • get

      public jakarta.servlet.http.Cookie get(jakarta.servlet.http.HttpServletRequest request)
    • getValue

      public String getValue(jakarta.servlet.http.HttpServletRequest request)
    • addCookie

      public void addCookie(jakarta.servlet.http.HttpServletResponse response, String cookieValue)
    • addCookie

      public void addCookie(jakarta.servlet.http.HttpServletResponse response, String cookieValue, Integer maxAge)
      Add a cookie with the given value and age to the response, using the cookie descriptor settings of this generator.
      Parameters:
      response - the HTTP response to add the cookie to
      cookieValue - the value of the cookie to add
      maxAge - max age value of the cookie to add
    • removeCookie

      public void removeCookie(jakarta.servlet.http.HttpServletResponse response)
      Remove the cookie that this generator describes from the response. Will generate a cookie with empty value and max age 0.
      Parameters:
      response - the HTTP response to remove the cookie from
    • constructAttributes

      protected List<String> constructAttributes(String cookieValue, Integer maxAge)
    • getName

      public String getName()
    • getPath

      public String getPath()
    • getDomain

      public String getDomain()
    • setDomain

      public void setDomain(String domain)
    • getMaxAge

      public Integer getMaxAge()
    • setMaxAge

      public void setMaxAge(Integer maxAge)
    • getSecure

      public Boolean getSecure()
    • setSecure

      public void setSecure(Boolean secure)
    • getHttpOnly

      public Boolean getHttpOnly()
    • setHttpOnly

      public void setHttpOnly(Boolean httpOnly)
    • getHostOnly

      public Boolean getHostOnly()
    • setHostOnly

      public void setHostOnly(Boolean hostOnly)
    • getSameSite

      public String getSameSite()
    • setSameSite

      public void setSameSite(String sameSite)