@Contract(threading=SAFE) public class BasicCookieStore extends java.lang.Object implements CookieStore, java.io.Serializable
CookieStore
Modifier and Type | Field and Description |
---|---|
private java.util.TreeSet<Cookie> |
cookies |
private java.util.concurrent.locks.ReadWriteLock |
lock |
private static long |
serialVersionUID |
Constructor and Description |
---|
BasicCookieStore() |
Modifier and Type | Method and Description |
---|---|
void |
addCookie(Cookie cookie)
Adds an
HTTP cookie , replacing any existing equivalent cookies. |
void |
addCookies(Cookie[] cookies)
Adds an array of
HTTP cookies . |
void |
clear()
Clears all cookies.
|
boolean |
clearExpired(java.util.Date date)
Removes all of
cookies in this HTTP state
that have expired by the specified date . |
java.util.List<Cookie> |
getCookies()
Returns an immutable array of
cookies that this HTTP
state currently contains. |
private void |
readObject(java.io.ObjectInputStream stream) |
java.lang.String |
toString() |
private static final long serialVersionUID
private final java.util.TreeSet<Cookie> cookies
private transient java.util.concurrent.locks.ReadWriteLock lock
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void addCookie(Cookie cookie)
HTTP cookie
, replacing any existing equivalent cookies.
If the given cookie has already expired it will not be added, but existing
values will still be removed.addCookie
in interface CookieStore
cookie
- the cookie
to be addedaddCookies(Cookie[])
public void addCookies(Cookie[] cookies)
HTTP cookies
. Cookies are added individually and
in the given array order. If any of the given cookies has already expired it will
not be added, but existing values will still be removed.cookies
- the cookies
to be addedaddCookie(Cookie)
public java.util.List<Cookie> getCookies()
cookies
that this HTTP
state currently contains.getCookies
in interface CookieStore
cookies
.public boolean clearExpired(java.util.Date date)
cookies
in this HTTP state
that have expired by the specified date
.clearExpired
in interface CookieStore
Cookie.isExpired(Date)
public void clear()
clear
in interface CookieStore
public java.lang.String toString()
toString
in class java.lang.Object