gov.llnl.babel.url.cookie

Class CookieJar

Implemented Interfaces:
Serializable

public class CookieJar
extends java.lang.Object
implements Serializable

CookieJar is a container for HTTP Cookie's. This container manages cookie expiration and determining which cookies are relevant to a particular URL.

Constructor Summary

CookieJar()

Method Summary

void
add(Cookie c)
Add a cookie to the jar.
Iterator
getRelevantCookies(String hostname, String path, int port)
Select and return cookies from this jar that are appropriate for the hostname, path and port given.
void
removeExpired()
Remove stale cookies from the jar.

Constructor Details

CookieJar

public CookieJar()

Method Details

add

public void add(Cookie c)
Add a cookie to the jar.

getRelevantCookies

public Iterator getRelevantCookies(String hostname,
                                   String path,
                                   int port)
Select and return cookies from this jar that are appropriate for the hostname, path and port given. The document "HTTP State Management Mechanism" dated August 27, 1999 gives detailed rules for deciding whether a cookie should be sent with a particular request. This method attempts to implement those rules.

removeExpired

public void removeExpired()
Remove stale cookies from the jar.