Interface CookieUtils
- All Known Implementing Classes:
GenericCookieUtilsImpl
public interface CookieUtils
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetCookieValue(javax.servlet.http.HttpServletRequest request, String cookieName) voidinvalidateCookie(javax.servlet.http.HttpServletResponse response, String cookieName) voidsetCookieValue(javax.servlet.http.HttpServletResponse response, String cookieName, String cookieValue) voidsetCookieValue(javax.servlet.http.HttpServletResponse response, String cookieName, String cookieValue, String path, Integer maxAge, Boolean isSecure) Uses a cookie value of "CookieInvalidationPlaceholderValue" because the later call to {@link ESAPI#httpUtilities()#addHeader(HttpServletResponse, String, String)} fails if the value isnullor an empty String.Checkscookies.use.secureSystem Property, which determines whether to use HTTPS cookie over HTTPS connection or HTTP only.
-
Field Details
-
CUSTOMER_COOKIE_NAME
- See Also:
-
-
Method Details
-
shouldUseSecureCookieIfApplicable
Boolean shouldUseSecureCookieIfApplicable()Checkscookies.use.secureSystem Property, which determines whether to use HTTPS cookie over HTTPS connection or HTTP only.- Returns:
- value of
cookies.use.secure
-
getCookieValue
-
setCookieValue
void setCookieValue(javax.servlet.http.HttpServletResponse response, String cookieName, String cookieValue, String path, Integer maxAge, Boolean isSecure) Uses a cookie value of "CookieInvalidationPlaceholderValue" because the later call to {@link ESAPI#httpUtilities()#addHeader(HttpServletResponse, String, String)} fails if the value isnullor an empty String. If an empty cookie value is passed, this is considered a request to remove the cookie andmaxAgeis set to 0 to force the removal. In addition, calls to {@link ESAPI#httpUtilities()#killCookie(HttpServletRequest, HttpServletResponse, String)} have shown to be ineffective while this approach for removing cookies works.- Parameters:
response-cookieName-cookieValue-path-maxAge-isSecure-
-
setCookieValue
-
invalidateCookie
-