Class CookieHandler
- java.lang.Object
-
- org.bardframework.commons.web.cookie.CookieHandler
-
public class CookieHandler extends Object
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.LoggerLOGGER
-
Constructor Summary
Constructors Constructor Description CookieHandler(String name)Default path that cookies will be visible to: "/", i.e.CookieHandler(String name, String path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCookie(javax.servlet.http.HttpServletResponse response, String cookieValue)voidaddCookie(javax.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.protected List<String>constructAttributes(String cookieValue, Integer maxAge)javax.servlet.http.Cookieget(javax.servlet.http.HttpServletRequest request)StringgetDomain()BooleangetHostOnly()BooleangetHttpOnly()IntegergetMaxAge()StringgetName()StringgetPath()StringgetSameSite()BooleangetSecure()StringgetValue(javax.servlet.http.HttpServletRequest request)voidremoveCookie(javax.servlet.http.HttpServletResponse response)Remove the cookie that this generator describes from the response.voidsetDomain(String domain)voidsetHostOnly(Boolean hostOnly)voidsetHttpOnly(Boolean httpOnly)voidsetMaxAge(Integer maxAge)voidsetSameSite(String sameSite)voidsetSecure(Boolean secure)
-
-
-
Method Detail
-
get
public javax.servlet.http.Cookie get(javax.servlet.http.HttpServletRequest request)
-
getValue
public String getValue(javax.servlet.http.HttpServletRequest request)
-
addCookie
public void addCookie(javax.servlet.http.HttpServletResponse response, String cookieValue)
-
addCookie
public void addCookie(javax.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 tocookieValue- the value of the cookie to addmaxAge- max age value of the cookie to add
-
removeCookie
public void removeCookie(javax.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
-
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)
-
-