Openfire 3.3.2 Javadoc

org.jivesoftware.util
Class CookieUtils

java.lang.Object
  extended by org.jivesoftware.util.CookieUtils

public class CookieUtils
extends Object


Constructor Summary
CookieUtils()
           
 
Method Summary
static void deleteCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.http.Cookie cookie)
          Deletes the specified cookie.
static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request, String name)
          Returns the specified cookie, or null if the cookie does not exist.
static void setCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String name, String value)
          Stores a value in a cookie.
static void setCookie(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String name, String value, int maxAge)
          Stores a value in a cookie.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CookieUtils

public CookieUtils()
Method Detail

getCookie

public static javax.servlet.http.Cookie getCookie(javax.servlet.http.HttpServletRequest request,
                                                  String name)
Returns the specified cookie, or null if the cookie does not exist. Note: because of the way that cookies are implemented it's possible for multiple cookies with the same name to exist (but with different domain values). This method will return the first cookie that has a name match.

Parameters:
request - the servlet request.
name - the name of the cookie.
Returns:
the Cookie object if it exists, otherwise null.

deleteCookie

public static void deleteCookie(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response,
                                javax.servlet.http.Cookie cookie)
Deletes the specified cookie.

Parameters:
request - the servlet request.
response - the servlet response.
cookie - the cookie object to be deleted.

setCookie

public static void setCookie(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             String name,
                             String value)
Stores a value in a cookie. By default this cookie will persist for 30 days.

Parameters:
request - the servlet request.
response - the servlet response.
name - a name to identify the cookie.
value - the value to store in the cookie.
See Also:
setCookie(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,String,String,int)

setCookie

public static void setCookie(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response,
                             String name,
                             String value,
                             int maxAge)
Stores a value in a cookie. This cookie will persist for the amount specified in the saveTime parameter.

Parameters:
request - the servlet request.
response - the servlet response.
name - a name to identify the cookie.
value - the value to store in the cookie.
maxAge - the time (in seconds) this cookie should live.
See Also:
setCookie(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,String,String)

Openfire 3.3.2 Javadoc

Copyright © 2003-2007 Jive Software.