A system-wide CookieHandler to be used by the HTTP URL stream protocol handler can be registered by doing a CookieHandler.setDefault(CookieHandler). The currently registered CookieHandler can be retrieved by calling CookieHandler.getDefault(). For more information on HTTP state management, see RFC 2965: HTTP State Management Mechanism
| Modifier and Type | Field and Description |
|---|---|
| private static CookieHandler | cookieHandler
The system-wide cookie handler that will apply cookies to the request headers and manage cookies from the response headers. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract Map | Returns: an immutable map from state management headers, with field names "Cookie" or "Cookie2" to a list of cookies containing state informationa uri, Map<String, List<String>> URI representing the intended use for the
cookiesa Map from request header
field names to lists of field values representing
the current request headers requestHeaders)Gets all the applicable cookies from a cookie cache for the specified uri in the request header. |
| public static synchronized CookieHandler | Returns: the system-wide cookie handler; A null return means there is no system-wide cookie handler currently set.Gets the system-wide cookie handler. |
| public abstract void | put(URI
a uri, Map<String, List<String>> URI where the cookies come froman immutable map from field names to
lists of field values representing the response
header fields returned responseHeaders)Sets all the applicable cookies, examples are response header fields that are named Set-Cookie2, present in the response headers into a cookie cache. |
| public static synchronized void | setDefault(CookieHandler
The HTTP cookie handler, or
cHandler)null to unset.Sets (or unsets) the system-wide cookie handler. |
| cookieHandler | back to summary |
|---|---|
| private static CookieHandler cookieHandler The system-wide cookie handler that will apply cookies to the request headers and manage cookies from the response headers.
| |
| CookieHandler | back to summary |
|---|---|
| public CookieHandler() Constructor for subclasses to call. | |
| get | back to summary |
|---|---|
| public abstract Map Gets all the applicable cookies from a cookie cache for the specified uri in the request header. The It is up to the implementation to take into account the HTTP protocol implementers should make sure that this method is called after all request headers related to choosing cookies are added, and before the request is sent.
| |
| getDefault | back to summary |
|---|---|
| public static synchronized CookieHandler getDefault() Gets the system-wide cookie handler.
| |
| put | back to summary |
|---|---|
| public abstract void put(URI uri, Map<String, List<String>> responseHeaders) throws IOException Sets all the applicable cookies, examples are response header fields that are named Set-Cookie2, present in the response headers into a cookie cache.
| |
| setDefault | back to summary |
|---|---|
| public static synchronized void setDefault(CookieHandler cHandler) Sets (or unsets) the system-wide cookie handler. Note non-standard http protocol handlers may ignore this setting.
| |