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
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.
-
Constructor Details
-
CookieHandler
public CookieHandler()
-
-
Method Details
-
getDefault
Returns the system-wide cookie handler ornullif not set. -
setDefault
Sets the system-wide cookie handler. -
get
public abstract Map<String,List<String>> get(URI uri, Map<String,List<String>> requestHeaders) throws IOExceptionGets 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
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.
-