public class CookieUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
CookieUtils.Lifespan
Some cookie lifespan to play with.
|
Constructor and Description |
---|
CookieUtils() |
Modifier and Type | Method and Description |
---|---|
static String |
getParameterValue(javax.servlet.http.HttpServletRequest request,
String name)
Returns the value of a request parameter, or if not found tries to find a cookie with the same name.
|
static void |
setCookie(javax.servlet.http.HttpServletResponse response,
String name,
String value)
Set a cookie on the client, with a default lifespan of @see Lifespan#HOUR
|
static void |
setCookie(javax.servlet.http.HttpServletResponse response,
String name,
String value,
CookieUtils.Lifespan lifeSpan)
Set a cookie on the client.
|
public CookieUtils()
public static final String getParameterValue(javax.servlet.http.HttpServletRequest request, String name)
request
- the HTTP requestname
- the parameter namepublic static final void setCookie(javax.servlet.http.HttpServletResponse response, String name, String value, CookieUtils.Lifespan lifeSpan)
response
- the HTTP response wrappername
- the cookie namevalue
- the cookie valuelifeSpan
- the cookie TTL as an CookieUtils.Lifespan
enum valueCopyright © 2005–2016 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.