public abstract class

CookieHandler

extends Object
java.lang.Object
   ↳ java.net.CookieHandler

Class Overview

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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public CookieHandler ()

Since: API Level 1

Public Methods

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

Since: API Level 1

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

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

public static CookieHandler getDefault ()

Since: API Level 1

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

Returns
  • the system-wide cookie handler.

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

Since: API Level 1

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

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

public static void setDefault (CookieHandler cHandler)

Since: API Level 1

Sets the system-wide cookie handler.

Parameters
cHandler a cookie handler to set as the system-wide default handler.