com.microsoft.tfs.core.httpclient.cookie
Class CookiePolicy

java.lang.Object
  extended by com.microsoft.tfs.core.httpclient.cookie.CookiePolicy

public abstract class CookiePolicy
extends java.lang.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

Field Summary
static java.lang.String BROWSER_COMPATIBILITY
          The policy that provides high degree of compatibilty with common cookie management of popular HTTP agents.
static java.lang.String DEFAULT
          The default cookie policy.
static java.lang.String HTTPCLIENT_STANDARD
          The policy used by default in HttpClient.
static java.lang.String IGNORE_COOKIES
          The policy that ignores cookies.
protected static org.apache.commons.logging.Log LOG
          Log object.
static java.lang.String NETSCAPE
          The Netscape cookie draft compliant policy.
static java.lang.String RFC_2109
          The RFC 2109 compliant policy.
static java.lang.String RFC_2965
          The RFC 2965 compliant policy.
 
Constructor Summary
CookiePolicy()
           
 
Method Summary
static CookieSpec getCookieSpec(java.lang.String id)
          Gets the cookie specification with the given ID.
static java.lang.String[] getRegisteredCookieSpecs()
          Obtains the currently registered cookie policy names.
static void registerCookieSpec(java.lang.String id, java.lang.Class<? extends CookieSpec> clazz)
          Registers a new cookie specification with the given identifier.
static void unregisterCookieSpec(java.lang.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 java.lang.String BROWSER_COMPATIBILITY
The policy that provides high degree of compatibilty with common cookie management of popular HTTP agents.

Constant Field Value:
"compatibility"
See Also:
Constant Field Values
Since:
3.0

NETSCAPE

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

Constant Field Value:
"netscape"
See Also:
Constant Field Values
Since:
3.0

RFC_2109

public static final java.lang.String RFC_2109
The RFC 2109 compliant policy.

Constant Field Value:
"rfc2109"
See Also:
Constant Field Values
Since:
3.0

RFC_2965

public static final java.lang.String RFC_2965
The RFC 2965 compliant policy.

Constant Field Value:
"rfc2965"
See Also:
Constant Field Values
Since:
3.0

HTTPCLIENT_STANDARD

public static final java.lang.String HTTPCLIENT_STANDARD
The policy used by default in HttpClient.

Constant Field Value:
"httpclient-standard"
See Also:
Constant Field Values

IGNORE_COOKIES

public static final java.lang.String IGNORE_COOKIES
The policy that ignores cookies.

Constant Field Value:
"ignoreCookies"
See Also:
Constant Field Values
Since:
3.0

DEFAULT

public static final java.lang.String DEFAULT
The default cookie policy.

Constant Field Value:
"default"
See Also:
Constant Field Values
Since:
3.0

LOG

protected static final org.apache.commons.logging.Log LOG
Log object.

Constructor Detail

CookiePolicy

public CookiePolicy()
Method Detail

registerCookieSpec

public static void registerCookieSpec(java.lang.String id,
                                      java.lang.Class<? extends CookieSpec> 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
See Also:
getCookieSpec(String)
Since:
3.0

unregisterCookieSpec

public static void unregisterCookieSpec(java.lang.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(java.lang.String id)
                                throws java.lang.IllegalStateException
Gets the cookie specification with the given ID.

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

getRegisteredCookieSpecs

public static java.lang.String[] getRegisteredCookieSpecs()
Obtains the currently registered cookie policy names. Note that the DEFAULT policy (if present) is likely to be the same as one of the other policies, but does not have to be.

Returns:
array of registered cookie policy names
Since:
3.1


© 2015 Microsoft. All rights reserved.