public class CookieManager extends CookieHandler
| Constructor and Description |
|---|
CookieManager()
Constructs a new cookie manager.
|
CookieManager(CookieStore store,
CookiePolicy cookiePolicy)
Constructs a new cookie manager using a specified cookie store and a
cookie policy.
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,List<String>> |
get(URI uri,
Map<String,List<String>> requestHeaders)
Searches and gets all cookies in the cache by the specified uri in the
request header.
|
CookieStore |
getCookieStore()
Gets current cookie store.
|
void |
put(URI uri,
Map<String,List<String>> responseHeaders)
Sets cookies according to uri and responseHeaders
|
void |
setCookiePolicy(CookiePolicy cookiePolicy)
Sets the cookie policy of this cookie manager.
|
getDefault, setDefaultpublic CookieManager()
public CookieManager(CookieStore store, CookiePolicy cookiePolicy)
store - a CookieStore to be used by cookie manager. The manager will
use a default one if the arg is null.cookiePolicy - a CookiePolicy to be used by cookie manager
ACCEPT_ORIGINAL_SERVER will be used if the arg is null.public Map<String,List<String>> get(URI uri, Map<String,List<String>> requestHeaders) throws IOException
get in class CookieHandleruri - the specified uri to search forrequestHeaders - a list of request headersIOException - if some error of I/O operation occurspublic void put(URI uri, Map<String,List<String>> responseHeaders) throws IOException
put in class CookieHandleruri - the specified uriresponseHeaders - a list of request headersIOException - if some error of I/O operation occurspublic void setCookiePolicy(CookiePolicy cookiePolicy)
cookiePolicy - the cookie policy. if null, the original policy will not be
changed.public CookieStore getCookieStore()