public class CookieManager extends Object implements Serializable
WebClient. This class is thread-safe.
You can disable Cookies by calling setCookiesEnabled(false). The
CookieManager itself takes care of this and ignores all cookie request if
disabled. If you override this your methods have to do the same.| Constructor and Description |
|---|
CookieManager()
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
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)
Deprecated.
as of 2.15 use
WebClient.getCookies(URL) |
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.
|
public void setCookiesEnabled(boolean enabled)
enabled - true to enable cookie support, false otherwisepublic boolean isCookiesEnabled()
public Set<Cookie> getCookies()
@Deprecated public Set<Cookie> getCookies(URL url)
WebClient.getCookies(URL)url - the URL on which to filter the returned cookiespublic boolean clearExpired(Date date)
date - the date to use for comparison when clearing expired cookiesprotected int getPort(URL url)
url - the URLpublic Cookie getCookie(String name)
name - the name of the cookie to returnpublic void addCookie(Cookie cookie)
cookie - the cookie to addpublic void removeCookie(Cookie cookie)
cookie - the cookie to removepublic void clearCookies()
Copyright © 2002–2014 Gargoyle Software Inc.. All rights reserved.