public class CookieUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static javax.servlet.http.Cookie |
createCookie(String name,
String content)
Create a cookie.
|
static javax.servlet.http.Cookie |
createCookie(String name,
String content,
String domain,
String path,
Integer maxAge)
Create a cookie.
|
static javax.servlet.http.Cookie |
createCookie(String name,
String content,
String domain,
String path,
Integer maxAge,
boolean sign,
String key)
Create and sign a cookie.
|
static javax.servlet.http.Cookie |
getCookie(javax.servlet.http.HttpServletRequest request,
String name)
Get a cookie.
|
static javax.servlet.http.Cookie |
getCookie(javax.servlet.http.HttpServletRequest request,
String name,
boolean sign,
String key)
Get a cookie and perform validity checks.
|
static String |
removeCookieSignature(String cookieValue)
Remove signature from cookie content.
|
public static javax.servlet.http.Cookie createCookie(String name, String content) throws SignatureException
name - content - a valid cookie content string. Binary content should be Base64
encoded. Text must be escaped to prevent issues with cookie
attributes like path or maxage.SignatureExceptionpublic static javax.servlet.http.Cookie createCookie(String name, String content, String domain, String path, Integer maxAge) throws SignatureException
name - content - a valid cookie content string. Binary content should be Base64
encoded. Text must be escaped to prevent issues with cookie
attributes like path or maxage.domain - path - maxAge - SignatureExceptionpublic static javax.servlet.http.Cookie createCookie(String name, String content, String domain, String path, Integer maxAge, boolean sign, String key) throws SignatureException
name - content - a valid cookie content string. Binary content should be Base64
encoded. Text must be escaped to prevent issues with cookie
attributes like path or maxage.domain - path - maxAge - sign - key - SignatureExceptionpublic static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request,
String name)
throws SignatureException
request - name - SignatureExceptionpublic static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request,
String name,
boolean sign,
String key)
throws SignatureException
request - name - sign - key - SignatureExceptionCopyright © 2009–2013. All rights reserved.