Class CookieUtils
java.lang.Object
net.kcqy.util.web.CookieUtils
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic void设置cookiestatic jakarta.servlet.http.CookiegetCookieByName(jakarta.servlet.http.HttpServletRequest request, String name) 根据名字获取cookiestatic voidremoveCookie(jakarta.servlet.http.HttpServletResponse response, String name)
-
Field Details
-
A_YEAR
public static final int A_YEAR- See Also:
-
-
Constructor Details
-
CookieUtils
public CookieUtils()
-
-
Method Details
-
addCookie
public static void addCookie(jakarta.servlet.http.HttpServletResponse response, String name, String value, int maxAge) throws UnsupportedEncodingException 设置cookie- Parameters:
response-name- cookie名字value- cookie值maxAge- cookie生命周期 以秒为单位- Throws:
UnsupportedEncodingException
-
addCookie
public static void addCookie(jakarta.servlet.http.HttpServletResponse response, String name, String value) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-
removeCookie
public static void removeCookie(jakarta.servlet.http.HttpServletResponse response, String name) throws UnsupportedEncodingException - Throws:
UnsupportedEncodingException
-
getCookieByName
public static jakarta.servlet.http.Cookie getCookieByName(jakarta.servlet.http.HttpServletRequest request, String name) throws UnsupportedEncodingException 根据名字获取cookie- Parameters:
request-name- cookie名字- Returns:
- Throws:
UnsupportedEncodingException
-