@ProviderType public class CookieUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static boolean |
addCookie(javax.servlet.http.Cookie cookie,
javax.servlet.http.HttpServletResponse response)
Add the provided HTTP Cookie to the Response
|
static int |
dropAllCookies(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String cookiePath)
Removes all cookies for the domain
|
static int |
dropCookies(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String cookiePath,
String... cookieNames)
Remove the named Cookies from Response
|
static int |
dropCookiesByRegex(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String cookiePath,
String... regexes)
Remove the Cookies whose names match the provided Regex from Response
|
static int |
dropCookiesByRegexArray(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String cookiePath,
String[] regexes)
Remove the Cookies whose names match the provided Regex from Response
|
static boolean |
extendCookieLife(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String cookieName,
String cookiePath,
int expiry)
Extend the cookie life.
|
static javax.servlet.http.Cookie |
getCookie(javax.servlet.http.HttpServletRequest request,
String cookieName)
Get the named cookie from the HTTP Request
|
static List<javax.servlet.http.Cookie> |
getCookies(javax.servlet.http.HttpServletRequest request,
String regex)
Gets Cookies from the Request whose names match the provides Regex
|
public static boolean addCookie(javax.servlet.http.Cookie cookie,
javax.servlet.http.HttpServletResponse response)
cookie - Cookie to addresponse - Response to add Cookie topublic static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request,
String cookieName)
request - Request to get the Cookie fromcookieName - name of Cookie to getpublic static List<javax.servlet.http.Cookie> getCookies(javax.servlet.http.HttpServletRequest request, String regex)
request - Request to get the Cookie fromregex - Regex to match against Cookie namespublic static boolean extendCookieLife(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String cookieName,
String cookiePath,
int expiry)
Extend the cookie life.
This can be used when a cookie should be valid for X minutes from the last point of activity. This method will leave expired or deleted cookies alone.request - Request to get the Cookie fromresponse - Response to write the extended Cookie tocookieName - Name of Cookie to extend the life ofexpiry - New Cookie expirypublic static int dropCookies(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String cookiePath,
String... cookieNames)
request - Request to get the Cookies to dropresponse - Response to expire the Cookies oncookieNames - Names of cookies to droppublic static int dropCookiesByRegex(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String cookiePath,
String... regexes)
request - Request to get the Cookies to dropresponse - Response to expire the Cookies onregexes - Regex to find Cookies to droppublic static int dropCookiesByRegexArray(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String cookiePath,
String[] regexes)
request - Request to get the Cookies to dropresponse - Response to expire the Cookies onregexes - Regex to find Cookies to droppublic static int dropAllCookies(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String cookiePath)
request - Request to get the Cookies to dropresponse - Response to expire the Cookies onCopyright © 2013–2020 Adobe. All rights reserved.