The CookieDictionary class represents the collection of Cookies that are sent to and received from the browser. Using the CookieDictionary, you can create, delete, and retrieve cookies, and enumerate through the set of cookies.
Creating a new Cookie
To create a new cookie, call the get method, passing in the new cookie name. The get( ) method will create a new cookie if one does not already exist with that name.
public class CookieDictionary extends java.util.Dictionary
implements aspcomp.Enumerator
{
public int getCount();
public Cookie getCookie(String name) throws
ClassCastException;
//
// aspcomp.Enumerator Methods
//
public void reset();
//
// java.util.Enumeration Methods
//
public Boolean hasMoreElements();
public Object nextElement() throws
NoSuchElementException,
ClassCastException;
//
// java.lang.Cloneable Method
//
public Object clone();
//
// java.util.Dictionary Methods
//
public int size();
public Boolean isEmpty();
public Enumeration keys();
public Enumeration elements();
public Object get(Object key);
public Object put(Object key, Object value);
public Object remove(Object key);
}
CookieDictionary Methods
Returns the number of items in the collection.
public Cookie getCookie(String name) throws ClassCastException;
Returns the cookie specified by name.
Enumerator Methods
Resets the Enumerator to the start of the collection.
public Boolean hasMoreElements( );
Returns true if there are any more items in the collection that can be obtained by calling nextElement().
public Object nextElement( ) throws NoSuchElementException, ClassCastException;
Returns the next Object in the collection. You should typically call this following a call to hasMoreElements().
Makes a copy of the Enumerator, with the current state of the Enumeration.
java.util.Dictionary Methods
Returns the number of entries in the dictionary.
Returns true only if the dictionary contains no entries.
Returns an Enumeration that will enumerate through all of the keys contained in the dictionary.
public Enumeration elements( );
Returns an Enumeration that will enumerate through all of the entries contained in the dictionary.
public Object get(Object key);
Returns the cookie for the specified key. If no cookie exists for the specified key, a new cookie will be created and returned.
Note that key must be of type String.
public Object put(Object key, Object value);
This method is not implemented for CookieDictionary. If called, it will throw an AspComponentException.
public Object remove(Object key);
This method is not implemented for CookieDictionary. If called, it will throw an AspComponentException.