public final class CookieUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
addCookie(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String name,
String value,
int age)
默认按照应用上下文进行设置
|
static void |
addCookie(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String name,
String value,
String path,
int age)
Convenience method to set a cookie
刚方法自动将value进行编码存储 |
static void |
deleteCookie(javax.servlet.http.HttpServletResponse response,
javax.servlet.http.Cookie cookie,
String path)
Convenience method for deleting a cookie by name
|
static void |
deleteCookieByName(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String name) |
static javax.servlet.http.Cookie |
getCookie(javax.servlet.http.HttpServletRequest request,
String name)
Convenience method to get a cookie by name
|
static String |
getCookieValue(javax.servlet.http.Cookie cookie) |
static String |
getCookieValue(javax.servlet.http.HttpServletRequest request,
String cookieName)
获取cookie中的value
自动负责解码 |
public static String getCookieValue(javax.servlet.http.Cookie cookie)
public static String getCookieValue(javax.servlet.http.HttpServletRequest request, String cookieName)
request - cookieName - public static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request,
String name)
request - the current requestname - the name of the cookie to findpublic static void addCookie(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String name,
String value,
String path,
int age)
response - name - value - path - public static void addCookie(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String name,
String value,
int age)
request - response - name - value - age - Exceptionpublic static void deleteCookieByName(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response,
String name)
public static void deleteCookie(javax.servlet.http.HttpServletResponse response,
javax.servlet.http.Cookie cookie,
String path)
response - the current web responsecookie - the cookie to deletepath - the path on which the cookie was set (i.e. /appfuse)Copyright © 2005–2018 The Beangle Software. All rights reserved.