Class CookieHandler
java.lang.Object
org.bardframework.commons.web.cookie.CookieHandler
-
Constructor Summary
ConstructorsConstructorDescriptionCookieHandler(String name) Default path that cookies will be visible to: "/", i.e.CookieHandler(String name, String path) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidAdd a cookie with the given value and age to the response, using the cookie descriptor settings of this generator.constructAttributes(String cookieValue, Integer maxAge) jakarta.servlet.http.Cookieget(jakarta.servlet.http.HttpServletRequest request) getName()getPath()getValue(jakarta.servlet.http.HttpServletRequest request) voidremoveCookie(jakarta.servlet.http.HttpServletResponse response) Remove the cookie that this generator describes from the response.voidvoidsetHostOnly(Boolean hostOnly) voidsetHttpOnly(Boolean httpOnly) voidvoidsetSameSite(String sameSite) void
-
Constructor Details
-
CookieHandler
Default path that cookies will be visible to: "/", i.e. the entire server. -
CookieHandler
-
-
Method Details
-
get
public jakarta.servlet.http.Cookie get(jakarta.servlet.http.HttpServletRequest request) -
getValue
-
addCookie
-
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 tocookieValue- the value of the cookie to addmaxAge- 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
-
getName
-
getPath
-
getDomain
-
setDomain
-
getMaxAge
-
setMaxAge
-
getSecure
-
setSecure
-
getHttpOnly
-
setHttpOnly
-
getHostOnly
-
setHostOnly
-
getSameSite
-
setSameSite
-