A container for HttpCookies.
HTTP cookies are stored along with a URI via add(URI, HttpCookie)
and retrieved via match(URI), which implements the path matching algorithm
defined by RFC 6265.
| Modifier and Type | Class and Description |
|---|---|
| public static class | HttpCookieStore.Default
A default implementation of |
| public static class | HttpCookieStore.Empty
An implementation of |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: whether the cookie has been addedthe uri, HttpCookie URI associated with the cookiethe cookie to add cookie)Adds a cookie to this store, if possible. |
| public List | |
| public boolean | |
| public List | |
| public boolean | Returns: whether the cookie has been removedthe uri, HttpCookie URI associated with the cookie to removethe cookie to remove cookie)Removes the cookie associated with the given |
| add | back to summary |
|---|---|
| public boolean add(URI uri, HttpCookie cookie) Adds a cookie to this store, if possible. The cookie may not be added for various reasons; for example, it may be already expired, or its domain attribute does not match that of the URI, etc. The cookie is associated with the given
| |
| all | back to summary |
|---|---|
public List
| |
| clear | back to summary |
|---|---|
| public boolean clear() Removes all the cookies from this store.
| |
| match | back to summary |
|---|---|
| public List Returns the cookies that match the given
| |
| remove | back to summary |
|---|---|
| public boolean remove(URI uri, HttpCookie cookie) Removes the cookie associated with the given
| |
A default implementation of HttpCookieStore.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private final Map | |
| private final AutoLock |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(URI
the uri, HttpCookie URI associated with the cookiethe cookie to add cookie)Implements org. Adds a cookie to this store, if possible. |
| public List | |
| protected boolean | Returns: whether the domain should be allowed to associate cookies tothe domain to test domain)Returns whether the given domain should be allowed to associate cookies to. |
| public boolean | clear()
Implements org. Removes all the cookies from this store. |
| private static boolean | |
| private static boolean | |
| public List | match(URI
the uri)URI to match againstImplements org. Returns the cookies that match the given |
| private String | |
| private static boolean | |
| public boolean | remove(URI
the uri, HttpCookie URI associated with the cookie to removethe cookie to remove cookie)Implements org. Removes the cookie associated with the given |
| private String | |
| private String |
| cookies | back to summary |
|---|---|
| private final Map<String, List<HttpCookieStore. | |
| lock | back to summary |
|---|---|
| private final AutoLock lock | |
| Default | back to summary |
|---|---|
| public Default() | |
| add | back to summary |
|---|---|
| public boolean add(URI uri, HttpCookie cookie) Implements org. Doc from org. Adds a cookie to this store, if possible. The cookie may not be added for various reasons; for example, it may be already expired, or its domain attribute does not match that of the URI, etc. The cookie is associated with the given
| |
| all | back to summary |
|---|---|
| public List Implements org.
| |
| allowDomain | back to summary |
|---|---|
| protected boolean allowDomain(String domain) Returns whether the given domain should be allowed to associate cookies to. Currently rejects "top-level" domains such as "com" or "org", so that it will not be possible to associate cookies to those domains. Unfortunately, it allows for "top-level" domains that have multiple labels such as "co.uk" or "gov.au". RFC 6265 prohibits domains that are IP addresses, but this method supports them (both IPv4 and IPv6, the latter must be bracketed) for testing purposes.
| |
| clear | back to summary |
|---|---|
| public boolean clear() Implements org. Doc from org. Removes all the cookies from this store.
| |
| domainMatches | back to summary |
|---|---|
| private static boolean domainMatches(String uriDomain, String domain, String cookieDomain) | |
| isSameOrSubDomain | back to summary |
|---|---|
| private static boolean isSameOrSubDomain(String subDomain, String domain) | |
| match | back to summary |
|---|---|
| public List Implements org. Doc from org. Returns the cookies that match the given
| |
| parentDomain | back to summary |
|---|---|
| private String parentDomain(String domain) | |
| pathMatches | back to summary |
|---|---|
| private static boolean pathMatches(String uriPath, String cookiePath) | |
| remove | back to summary |
|---|---|
| public boolean remove(URI uri, HttpCookie cookie) Implements org. Doc from org. Removes the cookie associated with the given
| |
| resolveDomain | back to summary |
|---|---|
| private String resolveDomain(URI uri, HttpCookie cookie) | |
| resolvePath | back to summary |
|---|---|
| private String resolvePath(URI uri, HttpCookie cookie) | |
| Modifier and Type | Field and Description |
|---|---|
| private final long | |
| private final String | |
| private final String | |
| private final URI |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the object to test for equality obj)Overrides org. Implements org. |
| public int | hashCode()
Overrides org. Implements org. |
| public boolean | isExpired()
Overrides org. Overrides default org. |
| creationNanoTime | back to summary |
|---|---|
| private final long creationNanoTime | |
| domain | back to summary |
|---|---|
| private final String domain | |
| path | back to summary |
|---|---|
| private final String path | |
| uri | back to summary |
|---|---|
| private final URI uri | |
| StoredHttpCookie | back to summary |
|---|---|
| private StoredHttpCookie(HttpCookie wrapped, URI uri, String domain, String path) | |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides org. Implements org. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides org. Implements org. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| isExpired | back to summary |
|---|---|
| public boolean isExpired() Overrides org. Overrides default org.
| |
An implementation of HttpCookieStore that does not store any cookie.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | add(URI
the uri, HttpCookie URI associated with the cookiethe cookie to add cookie)Implements org. Adds a cookie to this store, if possible. |
| public List | |
| public boolean | clear()
Implements org. Removes all the cookies from this store. |
| public List | match(URI
the uri)URI to match againstImplements org. Returns the cookies that match the given |
| public boolean | remove(URI
the uri, HttpCookie URI associated with the cookie to removethe cookie to remove cookie)Implements org. Removes the cookie associated with the given |
| Empty | back to summary |
|---|---|
| public Empty() | |
| add | back to summary |
|---|---|
| public boolean add(URI uri, HttpCookie cookie) Implements org. Doc from org. Adds a cookie to this store, if possible. The cookie may not be added for various reasons; for example, it may be already expired, or its domain attribute does not match that of the URI, etc. The cookie is associated with the given
| |
| all | back to summary |
|---|---|
| public List Implements org.
| |
| clear | back to summary |
|---|---|
| public boolean clear() Implements org. Doc from org. Removes all the cookies from this store.
| |
| match | back to summary |
|---|---|
| public List Implements org. Doc from org. Returns the cookies that match the given
| |
| remove | back to summary |
|---|---|
| public boolean remove(URI uri, HttpCookie cookie) Implements org. Doc from org. Removes the cookie associated with the given
| |