Class HttpCookieStore.Default
- All Implemented Interfaces:
HttpCookieStore
- Enclosing interface:
- HttpCookieStore
A default implementation of HttpCookieStore
.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.http.HttpCookieStore
HttpCookieStore.Default, HttpCookieStore.Empty
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(URI uri, HttpCookie cookie) Adds a cookie to this store, if possible.all()
protected boolean
allowDomain
(String domain) Returns whether the given domain should be allowed to associate cookies to.boolean
clear()
Removes all the cookies from this store.Returns the cookies that match the givenURI
.boolean
remove
(URI uri, HttpCookie cookie) Removes the cookie associated with the givenURI
.
-
Constructor Details
-
Default
public Default()
-
-
Method Details
-
add
Description copied from interface:HttpCookieStore
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 toHttpCookieStore.match(URI)
returns the cookie only if the URIs match.- Specified by:
add
in interfaceHttpCookieStore
- Parameters:
uri
- theURI
associated with the cookiecookie
- the cookie to add- Returns:
- whether the cookie has been added
-
allowDomain
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.
- Parameters:
domain
- the domain to test- Returns:
- whether the domain should be allowed to associate cookies to
-
all
- Specified by:
all
in interfaceHttpCookieStore
- Returns:
- all the cookies
-
match
Description copied from interface:HttpCookieStore
Returns the cookies that match the given
URI
.- Specified by:
match
in interfaceHttpCookieStore
- Parameters:
uri
- theURI
to match against- Returns:
- a list of cookies that match the given
URI
-
remove
Description copied from interface:HttpCookieStore
Removes the cookie associated with the given
URI
.- Specified by:
remove
in interfaceHttpCookieStore
- Parameters:
uri
- theURI
associated with the cookie to removecookie
- the cookie to remove- Returns:
- whether the cookie has been removed
-
clear
public boolean clear()Description copied from interface:HttpCookieStore
Removes all the cookies from this store.
- Specified by:
clear
in interfaceHttpCookieStore
- Returns:
- whether the store modified by this call
-