NextApp Echo
App Container 1.1.4

nextapp.echoservlet
Class CookieManager

java.lang.Object
  extended bynextapp.echoservlet.CookieManager
All Implemented Interfaces:
java.io.Serializable

public class CookieManager
extends java.lang.Object
implements java.io.Serializable

A utility class used to cookies set by an application on the client browser. Applications may obtain access to this object by retrieving their ServerContext from their EchoInstance and calling ServerContext.getCookieManager().

See Also:
Serialized Form

Constructor Summary
CookieManager()
           
 
Method Summary
 void add(javax.servlet.http.Cookie cookie)
          Adds a new cookie or updates an existing one.
 javax.servlet.http.Cookie get(java.lang.String name)
          Returns a cookie with the given name if it is exists or null if it does not.
 java.util.Iterator iterator()
          Returns an iterator over all present cookies.
 void remove(java.lang.String name)
          Removes the specified cookie.
 int size()
          Returns the number of cookies present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CookieManager

public CookieManager()
Method Detail

add

public void add(javax.servlet.http.Cookie cookie)
Adds a new cookie or updates an existing one. In the case of updating an existing cookie, be certain to reset its maximum age with setMaxAge() if necessary. (Cookies on the client browser do not report their maximum age to the server, only their value.)

Parameters:
cookie - The cookie to add or update.

get

public javax.servlet.http.Cookie get(java.lang.String name)
Returns a cookie with the given name if it is exists or null if it does not.

Parameters:
name - The name of the cookie to return.
Returns:
The cookie identified by name.

iterator

public java.util.Iterator iterator()
Returns an iterator over all present cookies.

Returns:
An iterator over all present cookies.

remove

public void remove(java.lang.String name)
Removes the specified cookie. This is accomplished by setting the cookie on the client with a maximum age of 0.

Parameters:
name - The name of the cookie to remove.

size

public int size()
Returns the number of cookies present. This is the number of cookies that the Echo application is tracking at the current time. Calls to the add and remove methods will increase or decrease this number even though the cookie has not yet been added or removed on the client.

Returns:
The number of cookies present.

NextApp Echo
App Container 1.1.4