Name
CookieUtils
Synopsis
Class Name: |
com.ora.jsp.util.CookieUtils |
Extends: |
None |
Implements: |
None |
Description
The CookieUtils
class contains a number of static methods
that can be used to work with
javax.servlet.http.Cookie
objects.
Class Summary
public class CookieUtils { // Methods public static String getCookieValue(String name, javax.servlet.http.HttpServletRequest req); public static boolean isCookieSet(String name, javax.servlet.http.HttpServletRequest req); public static void sendCookie(String name, String value, int maxAge, javax.servlet.http.HttpServletResponse res); }
Methods
-
public static String getCookieValue(String name, javax.servlet.http.HttpServletRequest req)
Returns the value of the cookie with the specified name, or
null
if not found.-
public static boolean isCookieSet(String name, javax.servlet.http.HttpServletRequest req)
Returns
true
if a cookie with the specified name is present in the request.-
public static void sendCookie(String name, String value, int maxAge, javax.servlet.http.HttpServletResponse res)
Creates a cookie with the specified name, value, and max age, and adds it to the response.
Get Java Server Pages now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.