public abstract class CookiePolicy
extends java.lang.Object
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:
| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String |
BROWSER_COMPATIBILITY
The policy that provides high degree of compatibilty
with common cookie management of popular HTTP agents.
|
static int |
COMPATIBILITY
已过时。
|
static java.lang.String |
DEFAULT
The default cookie policy.
|
static java.lang.String |
IGNORE_COOKIES
The policy that ignores cookies.
|
protected static Log |
LOG
Log object.
|
static java.lang.String |
NETSCAPE
The Netscape cookie draft compliant policy.
|
static int |
NETSCAPE_DRAFT
已过时。
Use
NETSCAPE |
static java.lang.String |
RFC_2109
The RFC 2109 compliant policy.
|
static java.lang.String |
RFC_2965
The RFC 2965 compliant policy.
|
static int |
RFC2109
已过时。
Use
RFC_2109 |
static int |
RFC2965
已过时。
Use
RFC_2965 |
| 构造器和说明 |
|---|
CookiePolicy() |
| 限定符和类型 | 方法和说明 |
|---|---|
static CookieSpec |
getCompatibilitySpec()
已过时。
|
static CookieSpec |
getCookieSpec(java.lang.String id)
Gets the
cookie specification with the given ID. |
static int |
getDefaultPolicy()
已过时。
Use
getDefaultSpec() |
static CookieSpec |
getDefaultSpec()
Returns
cookie specification registered as DEFAULT. |
static java.lang.String[] |
getRegisteredCookieSpecs()
Obtains the currently registered cookie policy names.
|
static CookieSpec |
getSpecByPolicy(int policy)
已过时。
|
static CookieSpec |
getSpecByVersion(int ver)
已过时。
|
static void |
registerCookieSpec(java.lang.String id,
java.lang.Class clazz)
Registers a new
cookie specification with the given identifier. |
static void |
setDefaultPolicy(int policy)
已过时。
|
static void |
unregisterCookieSpec(java.lang.String id)
Unregisters the
cookie specification with the given ID. |
public static final java.lang.String BROWSER_COMPATIBILITY
public static final java.lang.String NETSCAPE
public static final java.lang.String RFC_2109
public static final java.lang.String RFC_2965
public static final java.lang.String IGNORE_COOKIES
public static final java.lang.String DEFAULT
public static final int COMPATIBILITY
BROWSER_COMPATIBILITYpublic static final int NETSCAPE_DRAFT
NETSCAPEpublic static final int RFC2109
RFC_2109public static final int RFC2965
RFC_2965protected static final Log LOG
public static void registerCookieSpec(java.lang.String id,
java.lang.Class clazz)
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).id - the identifier for this specificationclazz - the cookie specification class to registergetCookieSpec(String)public static void unregisterCookieSpec(java.lang.String id)
cookie specification with the given ID.id - the ID of the cookie specification to unregisterpublic static CookieSpec getCookieSpec(java.lang.String id) throws java.lang.IllegalStateException
cookie specification with the given ID.id - the cookie specification IDcookie specificationjava.lang.IllegalStateException - if a policy with the ID cannot be foundpublic static int getDefaultPolicy()
getDefaultSpec()getDefaultSpec()public static void setDefaultPolicy(int policy)
registerCookieSpec(String, Class)policy - new default cookie policyDEFAULTpublic static CookieSpec getSpecByPolicy(int policy)
getCookieSpec(String)policy - cookie policy to get the CookieSpec forpublic static CookieSpec getDefaultSpec()
cookie specification registered as DEFAULT.
If no default cookie specification has been registered,
RFC2109 specification is returned.cookie specificationDEFAULTpublic static CookieSpec getSpecByVersion(int ver)
getCookieSpec(String)Supported versions:
ver - the cookie version to get the spec forpublic static CookieSpec getCompatibilitySpec()
getCookieSpec(String)public static java.lang.String[] getRegisteredCookieSpecs()