Skip to content

Most visited

Recently visited

navigation
Added in API level 1

CookieHandler

public abstract class CookieHandler
extends Object

java.lang.Object
   ↳ java.net.CookieHandler
Known Direct Subclasses


This class provides a way to manage cookies with a HTTP protocol handler.

Summary

Public constructors

CookieHandler()

Public methods

abstract Map<StringList<String>> get(URI uri, Map<StringList<String>> requestHeaders)

Gets all cookies for a specific URI from the cookie cache.

static CookieHandler getDefault()

Returns the system-wide cookie handler or null if not set.

abstract void put(URI uri, Map<StringList<String>> responseHeaders)

Sets all cookies of a specific URI in the responseHeaders into the cookie cache.

static void setDefault(CookieHandler cHandler)

Sets the system-wide cookie handler.

Inherited methods

From class java.lang.Object

Public constructors

CookieHandler

Added in API level 1
CookieHandler ()

Public methods

get

Added in API level 1
Map<StringList<String>> get (URI uri, 
                Map<StringList<String>> requestHeaders)

Gets all cookies for a specific URI from the cookie cache.

Parameters
uri URI: a URI to search for applicable cookies.
requestHeaders Map: a list of request headers.
Returns
Map<StringList<String>> an unchangeable map of all appropriate cookies.
Throws
IOException if an error occurs during the I/O operation.

getDefault

Added in API level 1
CookieHandler getDefault ()

Returns the system-wide cookie handler or null if not set.

Returns
CookieHandler

put

Added in API level 1
void put (URI uri, 
                Map<StringList<String>> responseHeaders)

Sets all cookies of a specific URI in the responseHeaders into the cookie cache.

Parameters
uri URI: the origin URI of the cookies.
responseHeaders Map: a list of request headers.
Throws
IOException if an error occurs during the I/O operation.

setDefault

Added in API level 1
void setDefault (CookieHandler cHandler)

Sets the system-wide cookie handler.

Parameters
cHandler CookieHandler
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.