Package org.craftercms.commons.http
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 Summary
Fields Modifier and Type Field Description static String
LOG_KEY_ADDED_COOKIE
static String
LOG_KEY_DELETED_COOKIE
-
Constructor Summary
Constructors Constructor Description CookieManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.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.void
setDomain(String domain)
void
setHttpOnly(boolean httpOnly)
void
setMaxAge(Integer maxAge)
void
setPath(String path)
void
setSecure(boolean secure)
-
-
-
Field Detail
-
LOG_KEY_ADDED_COOKIE
public static final String LOG_KEY_ADDED_COOKIE
- See Also:
- Constant Field Values
-
LOG_KEY_DELETED_COOKIE
public static final String LOG_KEY_DELETED_COOKIE
- See Also:
- Constant Field Values
-
-
Method Detail
-
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 cookievalue
- 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
-
-