Class Overview
A simple in-memory java.net.CookieStore implementation
Summary
Public Methods |
void
|
add(URI uri, HttpCookie cookie)
Add one cookie into cookie store.
|
List<HttpCookie>
|
get(URI uri)
Get all cookies, which:
1) given uri domain-matches with, or, associated with
given uri when added to the cookie store.
|
List<HttpCookie>
|
getCookies()
Get all cookies in cookie store, except those have expired
|
List<URI>
|
getURIs()
Get all URIs, which are associated with at least one cookie
of this cookie store.
|
boolean
|
remove(URI uri, HttpCookie ck)
Remove a cookie from store
|
boolean
|
removeAll()
Remove all cookies in this cookie store.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
|
From interface
java.net.CookieStore
abstract
void
|
add(URI uri, HttpCookie cookie)
Adds one HTTP cookie to the store.
|
abstract
List<HttpCookie>
|
get(URI uri)
Retrieve cookies associated with given URI, or whose domain matches the
given URI.
|
abstract
List<HttpCookie>
|
getCookies()
Get all not-expired cookies in cookie store.
|
abstract
List<URI>
|
getURIs()
Get all URIs which identify the cookies in this cookie store.
|
abstract
boolean
|
remove(URI uri, HttpCookie cookie)
Remove a cookie from store.
|
abstract
boolean
|
removeAll()
Remove all cookies in this cookie store.
|
|
Public Constructors
public
InMemoryCookieStore
()
Public Methods
public
void
add
(URI uri, HttpCookie cookie)
Add one cookie into cookie store.
Parameters
uri
| the uri this cookie associated with.
if null, this cookie will not be associated
with an URI |
cookie
| the cookie to store |
Get all cookies, which:
1) given uri domain-matches with, or, associated with
given uri when added to the cookie store.
3) not expired.
See RFC 2965 sec. 3.3.4 for more detail.
Returns
- an immutable list of HttpCookie,
return empty list if no cookies match the given URI
Get all cookies in cookie store, except those have expired
Returns
- an immutable list of http cookies;
return empty list if there's no http cookie in store
public
List<URI>
getURIs
()
Get all URIs, which are associated with at least one cookie
of this cookie store.
Returns
- an immutable list of URIs;
return empty list if no cookie in this cookie store
is associated with an URI
public
boolean
remove
(URI uri, HttpCookie ck)
Remove a cookie from store
Parameters
uri
| the uri this cookie associated with.
if null, the cookie to be removed is not associated
with an URI when added; if not null, the cookie
to be removed is associated with the given URI when added. |
ck
| the cookie to remove |
Returns
- true if this store contained the specified cookie
public
boolean
removeAll
()
Remove all cookies in this cookie store.
Returns
- true if this store changed as a result of the call