org.apache.commons.httpclient.cookie
Class CookiePolicy

java.lang.Object
  extended by org.apache.commons.httpclient.cookie.CookiePolicy

public abstract class CookiePolicy
extends Object

Cookie management policy class. The cookie policy provides corresponding cookie management interfrace for a given type or version of cookie.

RFC 2109 specification is used per default. Other supported specification can be chosen when appropriate or set default when desired

The following specifications are provided:

Since:
2.0
Author:
Oleg Kalnichevski, Mike Bowler

Field Summary
static String BROWSER_COMPATIBILITY
          The policy that provides high degree of compatibilty with common cookie management of popular HTTP agents.
static String DEFAULT
          The default cookie policy.
static String IGNORE_COOKIES
          The policy that ignores cookies.
protected static org.slf4j.Logger LOG
          Log object.
static String NETSCAPE
          The Netscape cookie draft compliant policy.
static String RFC_2109
          The RFC 2109 compliant policy.
 
Constructor Summary
CookiePolicy()
           
 
Method Summary
static CookieSpec getCookieSpec(String id)
          Gets the cookie specification with the given ID.
static CookieSpec getDefaultSpec()
          Returns cookie specification registered as DEFAULT.
static void registerCookieSpec(String id, Class clazz)
          Registers a new cookie specification with the given identifier.
static void unregisterCookieSpec(String id)
          Unregisters the cookie specification with the given ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BROWSER_COMPATIBILITY

public static final String BROWSER_COMPATIBILITY
The policy that provides high degree of compatibilty with common cookie management of popular HTTP agents.

Since:
3.0
See Also:
Constant Field Values

NETSCAPE

public static final String NETSCAPE
The Netscape cookie draft compliant policy.

Since:
3.0
See Also:
Constant Field Values

RFC_2109

public static final String RFC_2109
The RFC 2109 compliant policy.

Since:
3.0
See Also:
Constant Field Values

IGNORE_COOKIES

public static final String IGNORE_COOKIES
The policy that ignores cookies.

Since:
3.0
See Also:
Constant Field Values

DEFAULT

public static final String DEFAULT
The default cookie policy.

Since:
3.0
See Also:
Constant Field Values

LOG

protected static final org.slf4j.Logger LOG
Log object.

Constructor Detail

CookiePolicy

public CookiePolicy()
Method Detail

registerCookieSpec

public static void registerCookieSpec(String id,
                                      Class clazz)
Registers a new cookie specification with the given identifier. If a specification with the given ID already exists it will be overridden. This ID is the same one used to retrieve the cookie specification from getCookieSpec(String).

Parameters:
id - the identifier for this specification
clazz - the cookie specification class to register
Since:
3.0
See Also:
getCookieSpec(String)

unregisterCookieSpec

public static void unregisterCookieSpec(String id)
Unregisters the cookie specification with the given ID.

Parameters:
id - the ID of the cookie specification to unregister
Since:
3.0

getCookieSpec

public static CookieSpec getCookieSpec(String id)
                                throws IllegalStateException
Gets the cookie specification with the given ID.

Parameters:
id - the cookie specification ID
Returns:
cookie specification
Throws:
IllegalStateException - if a policy with the ID cannot be found
Since:
3.0

getDefaultSpec

public static CookieSpec getDefaultSpec()
Returns cookie specification registered as DEFAULT. If no default cookie specification has been registered, RFC2109 specification is returned.

Returns:
default cookie specification
See Also:
DEFAULT


Copyright (c) 1999-2005 - Apache Software Foundation