public class CookieUtil
extends java.lang.Object
CookieUtil helps in working with cookies on request/response objects.| Modifier and Type | Field and Description |
|---|---|
static boolean |
HTTP_ONLY |
static java.lang.String |
SESSION_COOKIE |
| Constructor and Description |
|---|
CookieUtil() |
| Modifier and Type | Method and Description |
|---|---|
static java.util.List<org.apache.commons.httpclient.Cookie> |
getSessionCookies(javax.servlet.http.HttpServletRequest request,
java.lang.String prefix,
java.lang.String remoteHost)
Deprecated.
since 6.1; Apache httpClient 3.x has been EOLed and contains security vulnerabilities
|
static boolean |
hasSessionCookie(java.util.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 java.lang.String |
hostFromUrl(java.lang.String url)
Extracts the host from a given URL.
|
static void |
setCookie(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String name,
java.lang.String value,
int maxAge,
boolean httpOnly)
Sets a cookie into the current response.
|
static void |
setSessionCookies(javax.servlet.http.HttpServletResponse response,
java.lang.String prefix,
java.util.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 java.lang.String SESSION_COOKIE
public static final boolean HTTP_ONLY
public static void setCookie(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
java.lang.String name,
java.lang.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 java.lang.String hostFromUrl(java.lang.String url)
url - A URLnull for an invalid URL.@Deprecated
public static java.util.List<org.apache.commons.httpclient.Cookie> getSessionCookies(javax.servlet.http.HttpServletRequest request,
java.lang.String prefix,
java.lang.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,
java.lang.String prefix,
java.util.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(java.util.List<org.apache.commons.httpclient.Cookie> cookies)
cookies - The list of cookies.true if cookies contains a session cookie.Copyright © 2010 - 2023 Adobe. All Rights Reserved