net.sourceforge.pebble.util
Class CookieUtils

java.lang.Object
  extended by net.sourceforge.pebble.util.CookieUtils

public class CookieUtils
extends java.lang.Object

Utilities for finding and manipulating cookies.

Author:
Simon Brown

Field Summary
static int ONE_MONTH
          represents 4 weeks in seconds
 
Constructor Summary
CookieUtils()
           
 
Method Summary
static void addCookie(HttpServletResponse response, java.lang.String name, java.lang.String value, int maxAge)
          Adds a cookie with the specified name, value and expiry.
static Cookie getCookie(Cookie[] cookies, java.lang.String name)
          Gets a reference to a named cookie from an array of cookies.
static void removeCookie(HttpServletResponse response, java.lang.String name)
          Removes a cookie with the specified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ONE_MONTH

public static final int ONE_MONTH
represents 4 weeks in seconds

See Also:
Constant Field Values
Constructor Detail

CookieUtils

public CookieUtils()
Method Detail

getCookie

public static Cookie getCookie(Cookie[] cookies,
                               java.lang.String name)
Gets a reference to a named cookie from an array of cookies.

Parameters:
cookies - an array of cookies
name - the name of the cookie to find
Returns:
a reference to a Cookie, or null if the cookie couldn't be found

addCookie

public static void addCookie(HttpServletResponse response,
                             java.lang.String name,
                             java.lang.String value,
                             int maxAge)
Adds a cookie with the specified name, value and expiry.

Parameters:
response - the HttpServletResponse to add the cookie to
name - the name of the cookie
value - the value of the cookie
maxAge - the maxAge of the cookie (in seconds)

removeCookie

public static void removeCookie(HttpServletResponse response,
                                java.lang.String name)
Removes a cookie with the specified name.

Parameters:
response - the HttpServletResponse to remove the cookie from
name - the name of the cookie


Copyright © 2003-2006, Simon Brown. All Rights Reserved.