public class CookieUtil extends Object
CookieUtil
helps in working with cookies on request/response objects.Modifier and Type | Field and Description |
---|---|
static boolean |
HTTP_ONLY |
static String |
SESSION_COOKIE |
Constructor and Description |
---|
CookieUtil() |
Modifier and Type | Method and Description |
---|---|
static List<org.apache.commons.httpclient.Cookie> |
getSessionCookies(javax.servlet.http.HttpServletRequest request,
String prefix,
String remoteHost)
Deprecated.
since 6.1; Apache httpClient 3.x has been EOLed and contains security vulnerabilities
|
static boolean |
hasSessionCookie(List<org.apache.commons.httpclient.Cookie> cookies)
Deprecated.
since 6.1; Apache httpClient 3.x has been EOLed and contains security vulnerabilities
|
static boolean |
hasUpdatedSessionCookies(org.apache.commons.httpclient.HttpMethod method)
Deprecated.
since 6.1; Apache httpClient 3.x has been EOLed and contains security vulnerabilities
|
static String |
hostFromUrl(String url)
Extracts the host from a given URL.
|
static void |
setCookie(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String name,
String value,
int maxAge,
boolean httpOnly)
Sets a cookie into the current response.
|
static void |
setSessionCookies(javax.servlet.http.HttpServletResponse response,
String prefix,
List<org.apache.commons.httpclient.Cookie> cookies)
Deprecated.
since 6.1; Apache httpClient 3.x has been EOLed and contains security vulnerabilities
|
public static final String SESSION_COOKIE
public static final boolean HTTP_ONLY
public static void setCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String name, String value, int maxAge, boolean httpOnly)
request
- The current request.response
- The current response.name
- The cookie name.value
- The cookie value.maxAge
- The expiry (in seconds from now). Pass -1 for no expiry, 0 to remove the cookie immediately.httpOnly
- Indicates the cookie should be accessible only from the server.public static String hostFromUrl(String url)
url
- A URLnull
for an invalid URL.@Deprecated public static List<org.apache.commons.httpclient.Cookie> getSessionCookies(javax.servlet.http.HttpServletRequest request, String prefix, String remoteHost)
request
- The request from which to read the cookies.prefix
- A name prefix filter.List
of cookies matching the prefix filter.@Deprecated public static void setSessionCookies(javax.servlet.http.HttpServletResponse response, String prefix, List<org.apache.commons.httpclient.Cookie> cookies)
response
- The response to which the cookies are to be written.prefix
- A string to be prefixed to each cookie name.cookies
- The list of cookies.@Deprecated public static boolean hasUpdatedSessionCookies(org.apache.commons.httpclient.HttpMethod method)
method
- The executed HTTP method.true
if response contains session cookies. false
otherwise.@Deprecated public static boolean hasSessionCookie(List<org.apache.commons.httpclient.Cookie> cookies)
cookies
- The list of cookies.true
if cookies
contains a session cookie."Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"