Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.sonalb.net.http.cookie
Class CookieJar  view CookieJar download CookieJar.java

java.lang.Object
  extended bycom.sonalb.net.http.cookie.CookieJar
All Implemented Interfaces:
java.util.Collection, java.lang.Iterable, java.io.Serializable

public class CookieJar
extends java.lang.Object
implements java.util.Collection, java.io.Serializable

Container for Cookie objects. Each CookieJar is independent of any request. This means that a single CookieJar can hold all the cookies for a number of requests and servers.


Field Summary
static java.lang.String CVSID
           
private  int iNumCookies
           
private static java.util.logging.Logger logger
           
private  java.util.Vector theJar
           
 
Constructor Summary
  CookieJar()
          Creates an empty CookieJar.
  CookieJar(java.util.Collection c)
          Creates a CookieJar, and populates it with Cookies from input Collection.
protected CookieJar(int initialCapacity, int growthStep)
           
 
Method Summary
 boolean add(java.lang.Object o)
          Add an element to this collection.
 boolean addAll(java.util.Collection c)
          Add the contents of a given collection to this collection.
 void clear()
          Clear the collection, such that a subsequent call to isEmpty() would return true.
 boolean contains(java.lang.Object o)
          Test whether this collection contains a given object as one of its elements.
 boolean containsAll(java.util.Collection c)
          Test whether this collection contains every element in a given collection.
protected  int getCookieIndex(Cookie c)
           
 CookieJar getCookies(CookieMatcher cm)
          Gets all Cookies that match the given CookieMatcher.
 CookieJar getCookies(java.lang.String cookieName)
          Gets all Cookies with the given name.
 CookieJar getVersionCookies(java.lang.String ver)
          Gets all Cookies having given version.
 boolean isEmpty()
          Test whether this collection is empty, that is, if size() == 0.
 java.util.Iterator iterator()
          Obtain an Iterator over this collection.
 boolean remove(java.lang.Object o)
          Remove a single occurrence of an object from this collection.
 boolean removeAll(java.util.Collection c)
          Remove all elements of a given collection from this collection.
 void removeCookies(CookieMatcher cm)
          Removes all cookies that match the given CookieMatcher.
 boolean retainAll(java.util.Collection c)
          Remove all elements of this collection that are not contained in a given collection.
 int size()
          Get the number of elements in this collection.
 java.lang.Object[] toArray()
          Copy the current contents of this collection into an array.
 java.lang.Object[] toArray(java.lang.Object[] array)
          Copy the current contents of this collection into an array.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Field Detail

CVSID

public static final java.lang.String CVSID
See Also:
Constant Field Values

logger

private static java.util.logging.Logger logger

theJar

private java.util.Vector theJar

iNumCookies

private int iNumCookies
Constructor Detail

CookieJar

public CookieJar()
Creates an empty CookieJar.


CookieJar

public CookieJar(java.util.Collection c)
Creates a CookieJar, and populates it with Cookies from input Collection. All the objects in the input Collection NEED NOT be Cookie objects.


CookieJar

protected CookieJar(int initialCapacity,
                    int growthStep)
Method Detail

add

public boolean add(java.lang.Object o)
Description copied from interface: java.util.Collection
Add an element to this collection.

Specified by:
add in interface java.util.Collection

addAll

public boolean addAll(java.util.Collection c)
Description copied from interface: java.util.Collection
Add the contents of a given collection to this collection.

Specified by:
addAll in interface java.util.Collection

iterator

public java.util.Iterator iterator()
Description copied from interface: java.util.Collection
Obtain an Iterator over this collection.

Specified by:
iterator in interface java.util.Collection

contains

public boolean contains(java.lang.Object o)
Description copied from interface: java.util.Collection
Test whether this collection contains a given object as one of its elements.

Specified by:
contains in interface java.util.Collection

containsAll

public boolean containsAll(java.util.Collection c)
Description copied from interface: java.util.Collection
Test whether this collection contains every element in a given collection.

Specified by:
containsAll in interface java.util.Collection

toArray

public java.lang.Object[] toArray()
Description copied from interface: java.util.Collection
Copy the current contents of this collection into an array.

Specified by:
toArray in interface java.util.Collection

toArray

public java.lang.Object[] toArray(java.lang.Object[] array)
Description copied from interface: java.util.Collection
Copy the current contents of this collection into an array. If the array passed as an argument has length less than the size of this collection, an array of the same run-time type as a, and length equal to the size of this collection, is allocated using Reflection. Otherwise, a itself is used. The elements of this collection are copied into it, and if there is space in the array, the following element is set to null. The resultant array is returned. Note: The fact that the following element is set to null is only useful if it is known that this collection does not contain any null elements.

Specified by:
toArray in interface java.util.Collection

clear

public void clear()
Description copied from interface: java.util.Collection
Clear the collection, such that a subsequent call to isEmpty() would return true.

Specified by:
clear in interface java.util.Collection

removeAll

public boolean removeAll(java.util.Collection c)
Description copied from interface: java.util.Collection
Remove all elements of a given collection from this collection. That is, remove every element e such that c.contains(e).

Specified by:
removeAll in interface java.util.Collection

retainAll

public boolean retainAll(java.util.Collection c)
Description copied from interface: java.util.Collection
Remove all elements of this collection that are not contained in a given collection. That is, remove every element e such that !c.contains(e).

Specified by:
retainAll in interface java.util.Collection

remove

public boolean remove(java.lang.Object o)
Description copied from interface: java.util.Collection
Remove a single occurrence of an object from this collection. That is, remove an element e, if one exists, such that o == null ? e == null : o.equals(e).

Specified by:
remove in interface java.util.Collection

removeCookies

public void removeCookies(CookieMatcher cm)
Removes all cookies that match the given CookieMatcher.


getCookieIndex

protected int getCookieIndex(Cookie c)

size

public int size()
Description copied from interface: java.util.Collection
Get the number of elements in this collection.

Specified by:
size in interface java.util.Collection

isEmpty

public boolean isEmpty()
Description copied from interface: java.util.Collection
Test whether this collection is empty, that is, if size() == 0.

Specified by:
isEmpty in interface java.util.Collection

getCookies

public CookieJar getCookies(CookieMatcher cm)
Gets all Cookies that match the given CookieMatcher.


getCookies

public CookieJar getCookies(java.lang.String cookieName)
Gets all Cookies with the given name.


getVersionCookies

public CookieJar getVersionCookies(java.lang.String ver)
Gets all Cookies having given version.


toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).