|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.gargoylesoftware.htmlunit.CookieManager
public class CookieManager
Manages cookies for a WebClient. This class is thread-safe.
| Field Summary | |
|---|---|
static String |
HTMLUNIT_COOKIE_POLICY
HtmlUnit's cookie policy is to be browser-compatible. |
| Constructor Summary | |
|---|---|
CookieManager()
Creates a new instance. |
|
| Method Summary | |
|---|---|
void |
addCookie(Cookie cookie)
Adds the specified cookie. |
void |
clearCookies()
Removes all cookies. |
boolean |
clearExpired(Date date)
Clears all cookies that have expired before supplied date. |
Cookie |
getCookie(String name)
Returns the currently configured cookie with the specified name, or null if one does not exist. |
Set<Cookie> |
getCookies()
Returns the currently configured cookies, in an unmodifiable set. |
Set<Cookie> |
getCookies(URL url)
Returns the currently configured cookies applicable to the specified URL, in an unmodifiable set. |
protected int |
getPort(URL url)
Gets the port of the URL. |
boolean |
isCookiesEnabled()
Returns true if cookies are enabled. |
void |
removeCookie(Cookie cookie)
Removes the specified cookie. |
void |
setCookiesEnabled(boolean enabled)
Enables/disables cookie support. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String HTMLUNIT_COOKIE_POLICY
CookieSpecs constants directly.
| Constructor Detail |
|---|
public CookieManager()
| Method Detail |
|---|
public void setCookiesEnabled(boolean enabled)
enabled - true to enable cookie support, false otherwisepublic boolean isCookiesEnabled()
public Set<Cookie> getCookies()
public Set<Cookie> getCookies(URL url)
url - the URL on which to filter the returned cookies
public boolean clearExpired(Date date)
date - the date to use for comparison when clearing expired cookies
protected int getPort(URL url)
public Cookie getCookie(String name)
name - the name of the cookie to return
public void addCookie(Cookie cookie)
cookie - the cookie to addpublic void removeCookie(Cookie cookie)
cookie - the cookie to removepublic void clearCookies()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||