Package java.net
Class CookieHandler
- java.lang.Object
-
- java.net.CookieHandler
-
- Direct Known Subclasses:
CookieManager
public abstract class CookieHandler extends Object
This class provides a way to manage cookies with a HTTP protocol handler.
-
-
Constructor Summary
Constructors Constructor Description CookieHandler()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract Map<String,List<String>>get(URI uri, Map<String,List<String>> requestHeaders)Gets all cookies for a specific URI from the cookie cache.static CookieHandlergetDefault()Returns the system-wide cookie handler ornullif not set.abstract voidput(URI uri, Map<String,List<String>> responseHeaders)Sets all cookies of a specific URI in theresponseHeadersinto the cookie cache.static voidsetDefault(CookieHandler cHandler)Sets the system-wide cookie handler.
-
-
-
Method Detail
-
getDefault
public static CookieHandler getDefault()
Returns the system-wide cookie handler ornullif not set.
-
setDefault
public static void setDefault(CookieHandler cHandler)
Sets the system-wide cookie handler.
-
get
public abstract Map<String,List<String>> get(URI uri, Map<String,List<String>> requestHeaders) throws IOException
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.
-
put
public abstract void put(URI uri, Map<String,List<String>> responseHeaders) throws IOException
Sets all cookies of a specific URI in theresponseHeadersinto 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.
-
-