public class CookieUtils extends Object
Modifier and Type | Field and Description |
---|---|
static ResourceBundle |
bundle |
static String |
BUNDLE_NAME |
static Debug |
debug |
Constructor and Description |
---|
CookieUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addCookieToResponse(javax.servlet.http.HttpServletResponse response,
javax.servlet.http.Cookie cookie)
Add cookie to HttpServletResponse as custom header
|
static String |
getCookieSameSite()
Returns property value of "org.openidentityplatform.openam.cookie.samesite"
|
static String |
getCookieValueFromReq(javax.servlet.http.HttpServletRequest req,
String name)
Gets value of cookie that has mached name in servlet request
|
static String |
getPreferCookieName(String reqURI)
Gets the preferred cookie name based on the HttpRequest URI.
|
static boolean |
isCookieHttpOnly()
Gets property value of "com.sun.identity.cookie.httponly"
|
static boolean |
isCookieSecure()
Gets property value of "com.iplanet.am.cookie.secure"
|
static boolean |
isSAML2(javax.servlet.http.HttpServletRequest req) |
static javax.servlet.http.Cookie |
newCookie(String name,
String value)
Constructs a cookie with a specified name and value.
|
static javax.servlet.http.Cookie |
newCookie(String name,
String value,
int maxAge)
Constructs a cookie with a specified name and value and sets
the maximum age of the cookie in seconds.
|
static javax.servlet.http.Cookie |
newCookie(String name,
String value,
int maxAge,
String path,
String domain)
Constructs a cookie with a specified name and value and sets
the maximum age of the cookie in seconds and sets
a path for the cookie to which the client should return the cookie
and sets the domain within which this cookie should be presented.
|
static javax.servlet.http.Cookie |
newCookie(String name,
String value,
String path)
Constructs a cookie with a specified name and value and sets
a path for the cookie to which the client should return the cookie.
|
static javax.servlet.http.Cookie |
newCookie(String name,
String value,
String path,
String domain)
Constructs a cookie with a specified name and value and sets
a path for the cookie to which the client should return the cookie
and sets the domain within which this cookie should be presented.
|
static void |
sendError(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
int httpStatusCode,
String errorCode,
String errorMsg)
Sends to error page URL for processing.
|
public static Debug debug
public static final String BUNDLE_NAME
public static ResourceBundle bundle
public static boolean isCookieSecure()
public static boolean isCookieHttpOnly()
public static String getCookieSameSite()
public static boolean isSAML2(javax.servlet.http.HttpServletRequest req)
public static String getCookieValueFromReq(javax.servlet.http.HttpServletRequest req, String name)
req
- HttpServletRequest requestname
- cookie name in servlet requestpublic static javax.servlet.http.Cookie newCookie(String name, String value)
name
- a String specifying the name of the cookievalue
- a String specifying the value of the cookiepublic static javax.servlet.http.Cookie newCookie(String name, String value, int maxAge)
name
- a String specifying the name of the cookievalue
- a String specifying the value of the cookiemaxAge
- an integer specifying the maximum age of the cookie in
seconds; if negative, means the cookie is not stored;
if zero, deletes the cookiepublic static javax.servlet.http.Cookie newCookie(String name, String value, String path)
name
- a String specifying the name of the cookievalue
- a String specifying the value of the cookiepath
- a String specifying a pathpublic static javax.servlet.http.Cookie newCookie(String name, String value, String path, String domain)
name
- a String specifying the name of the cookievalue
- a String specifying the value of the cookiepath
- a String specifying a pathdomain
- a String containing the domain name within which
this cookie is visible; form is according to RFC 2109
public static javax.servlet.http.Cookie newCookie(String name, String value, int maxAge, String path, String domain)
name
- a String specifying the name of the cookievalue
- a String specifying the value of the cookiemaxAge
- an integer specifying the maximum age of the cookie in
seconds; if negative, means the cookie is not stored;
if zero, deletes the cookiepath
- a String specifying a pathdomain
- a String containing the domain name within which
this cookie is visible; form is according to RFC 2109public static String getPreferCookieName(String reqURI)
reqURI
- a String specifying the HttpRequest URI.public static void sendError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, int httpStatusCode, String errorCode, String errorMsg)
request
- HttpServletRequest objectresponse
- HttpServletResponse objecthttpStatusCode
- Http Status codeerrorCode
- Error codeerrorMsg
- Detailed error messagepublic static void addCookieToResponse(javax.servlet.http.HttpServletResponse response, javax.servlet.http.Cookie cookie)
response
- cookie
- Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.