public class BasicCookieManager
extends java.lang.Object
Constructor and Description |
---|
BasicCookieManager()
Creates the cookie manager
|
Modifier and Type | Method and Description |
---|---|
void |
clearAllCookies()
Clears all the cookies from the manager
|
java.util.Set<ScrapingCookie> |
getAllCookies()
Returns a set of all cookies currently in the manager (these may include expired cookies)
|
java.util.Set<ScrapingCookie> |
getCookies(java.util.List<java.lang.String> domainPath,
java.lang.String path,
boolean includeUnspecifiedCookies,
boolean includeSecure)
Returns a set of cookies for the current domain.
|
java.util.Set<ScrapingCookie> |
getCookies(java.lang.String domain,
java.lang.String path,
boolean includeUnspecifiedCookies,
boolean includeSecure)
Returns a set of cookies for the current domain.
|
boolean |
isAutoTrimOldCookies()
Returns the AutoTrimOldCookies for the object
|
void |
setAutoTrimOldCookies(boolean autoTrimOldCookies)
Sets the AutoTrimOldCookies for the object
|
void |
trimOldCookies()
Trims the data structure to remove old cookies
|
void |
updateCookies(java.net.URL url,
java.util.List<ScrapingCookie> cookies)
Updates the cookie manager with cookies given
|
public boolean isAutoTrimOldCookies()
public void setAutoTrimOldCookies(boolean autoTrimOldCookies)
autoTrimOldCookies
- The new value for AutoTrimOldCookiespublic void updateCookies(@Nullable java.net.URL url, @NotNull java.util.List<ScrapingCookie> cookies)
url
- The url for the request that got these cookies as a responsecookies
- The cookies to addpublic java.util.Set<ScrapingCookie> getAllCookies()
public void trimOldCookies()
public void clearAllCookies()
public java.util.Set<ScrapingCookie> getCookies(@NotNull java.lang.String domain, @NotNull java.lang.String path, boolean includeUnspecifiedCookies, boolean includeSecure)
domain
- The domain for which to get cookiespath
- The path for the cookiesincludeUnspecifiedCookies
- True if we want cookies that are to be sent with a request but don't indicate secure or not secure onlyincludeSecure
- True if we want cookies that are to be sent with a secure requestpublic java.util.Set<ScrapingCookie> getCookies(@NotNull java.util.List<java.lang.String> domainPath, @NotNull java.lang.String path, boolean includeUnspecifiedCookies, boolean includeSecure)
domainPath
- The domain for which to get cookies (such as ["www", "google", "com"])path
- The path for the cookies, inside the domainincludeUnspecifiedCookies
- True if we want cookies that are to be sent with a request but don't indicate secure or not secure onlyincludeSecure
- True if we want cookies that are to be sent with a secure request