Class CookieUtils
- java.lang.Object
-
- dk.netarkivet.harvester.webinterface.CookieUtils
-
public class CookieUtils extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CookieUtils.Lifespan
Some cookie lifespan to play with.
-
Constructor Summary
Constructors Constructor Description CookieUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method 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#HOURstatic void
setCookie(javax.servlet.http.HttpServletResponse response, String name, String value, CookieUtils.Lifespan lifeSpan)
Set a cookie on the client.
-
-
-
Method Detail
-
getParameterValue
public static final 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.- Parameters:
request
- the HTTP requestname
- the parameter name- Returns:
- the value (never null, may be empty)
-
setCookie
public static final void setCookie(javax.servlet.http.HttpServletResponse response, String name, String value, CookieUtils.Lifespan lifeSpan)
Set a cookie on the client.- Parameters:
response
- the HTTP response wrappername
- the cookie namevalue
- the cookie valuelifeSpan
- the cookie TTL as anCookieUtils.Lifespan
enum value
-
-