dk.netarkivet.harvester.webinterface
Class CookieUtils
java.lang.Object
dk.netarkivet.harvester.webinterface.CookieUtils
public class CookieUtils
- extends java.lang.Object
Method Summary |
static java.lang.String |
getParameterValue(javax.servlet.http.HttpServletRequest request,
java.lang.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,
java.lang.String name,
java.lang.String value)
Set a cookie on the client, with a default lifespan of @see Lifespan#HOUR |
static void |
setCookie(javax.servlet.http.HttpServletResponse response,
java.lang.String name,
java.lang.String value,
CookieUtils.Lifespan lifeSpan)
Set a cookie on the client. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CookieUtils
public CookieUtils()
getParameterValue
public static final java.lang.String getParameterValue(javax.servlet.http.HttpServletRequest request,
java.lang.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,
java.lang.String name,
java.lang.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 an CookieUtils.Lifespan
enum value
setCookie
public static final void setCookie(javax.servlet.http.HttpServletResponse response,
java.lang.String name,
java.lang.String value)
- Set a cookie on the client, with a default lifespan of @see Lifespan#HOUR
- Parameters:
response
- the HTTP response wrappername
- the cookie namevalue
- the cookie value