Package be.personify.util.http
Class CookieUtil
- java.lang.Object
-
- be.personify.util.http.CookieUtil
-
public class CookieUtil extends Object
Class to get and set cookies- Author:
- vanderw
-
-
Constructor Summary
Constructors Constructor Description CookieUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static javax.servlet.http.CookiegetCookie(javax.servlet.http.HttpServletRequest request, String name)Gets a cookiestatic StringgetCookieValue(javax.servlet.http.HttpServletRequest request, String name)Returns the value of a cookie if presentstatic voidsetCookie(javax.servlet.http.HttpServletResponse response, String name, String value, String path, int expirySeconds, boolean secure, String domain)Sets a cookie
-
-
-
Method Detail
-
getCookie
public static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request, String name)Gets a cookie- Parameters:
request- the HttpServletRequestname- the name of the cookie- Returns:
- the cookie
-
getCookieValue
public static String getCookieValue(javax.servlet.http.HttpServletRequest request, String name)
Returns the value of a cookie if present- Parameters:
request- the HttpServletRequestname- the name of the cookie- Returns:
- the value of the cookie with the name specified
-
setCookie
public static void setCookie(javax.servlet.http.HttpServletResponse response, String name, String value, String path, int expirySeconds, boolean secure, String domain)Sets a cookie- Parameters:
response- the HttpServletResponsename- the name of the cookievalue- the value of the cookiepath- the patch of the cookieexpirySeconds- the expiry time of the cookie in secondssecure- indicating if it has to be securedomain- the domain on which the cookie has to be set
-
-