Interface HttpCookieStore
- All Known Implementing Classes:
HttpCookieStore.Default, HttpCookieStore.Empty
public interface HttpCookieStore
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.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA default implementation ofHttpCookieStore.static classAn implementation ofHttpCookieStorethat does not store any cookie. -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(URI uri, HttpCookie cookie) Adds a cookie to this store, if possible.all()booleanclear()Removes all the cookies from this store.Returns the cookies that match the givenURI.booleanremove(URI uri, HttpCookie cookie) Removes the cookie associated with the givenURI.
-
Method Details
-
add
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
URI, so that a call tomatch(URI)returns the cookie only if the URIs match.- Parameters:
uri- theURIassociated with the cookiecookie- the cookie to add- Returns:
- whether the cookie has been added
-
all
List<HttpCookie> all()- Returns:
- all the cookies
-
match
Returns the cookies that match the given
URI.- Parameters:
uri- theURIto match against- Returns:
- a list of cookies that match the given
URI
-
remove
Removes the cookie associated with the given
URI.- Parameters:
uri- theURIassociated with the cookie to removecookie- the cookie to remove- Returns:
- whether the cookie has been removed
-
clear
boolean clear()Removes all the cookies from this store.
- Returns:
- whether the store modified by this call
-