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.SignatureException
public 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
- SignatureException
public 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
- SignatureException
public static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request, String name) throws SignatureException
request
- name
- SignatureException
public static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request, String name, boolean sign, String key) throws SignatureException
request
- name
- sign
- key
- SignatureException
Copyright © 2009–2013. All rights reserved.