public class

BasicCookieStore

extends Object
implements CookieStore
java.lang.Object
   ↳ org.apache.http.impl.client.BasicCookieStore

Class Overview

Default implementation of CookieStore

Summary

Public Constructors
BasicCookieStore()
Default constructor.
Public Methods
synchronized void addCookie(Cookie cookie)
Adds an HTTP cookie, replacing any existing equivalent cookies.
synchronized void addCookies(Cookie[] cookies)
Adds an array of HTTP cookies.
synchronized void clear()
Clears all cookies.
synchronized boolean clearExpired(Date date)
Removes all of cookies in this HTTP state that have expired by the specified date.
synchronized List<Cookie> getCookies()
Returns an immutable array of cookies that this HTTP state currently contains.
String toString()
Returns a string containing a concise, human-readable description of this object.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.apache.http.client.CookieStore

Public Constructors

public BasicCookieStore ()

Since: API Level 1

Default constructor.

Public Methods

public synchronized void addCookie (Cookie cookie)

Since: API Level 1

Adds an 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.

Parameters
cookie the cookie to be added

public synchronized void addCookies (Cookie[] cookies)

Since: API Level 1

Adds an array of 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.

Parameters
cookies the cookies to be added

public synchronized void clear ()

Since: API Level 1

Clears all cookies.

public synchronized boolean clearExpired (Date date)

Since: API Level 1

Removes all of cookies in this HTTP state that have expired by the specified date.

Returns
  • true if any cookies were purged.
See Also

public synchronized List<Cookie> getCookies ()

Since: API Level 1

Returns an immutable array of cookies that this HTTP state currently contains.

Returns

public String toString ()

Since: API Level 1

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation simply concatenates the class name, the '@' sign and a hexadecimal representation of the object's hashCode(), that is, it is equivalent to the following expression:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
  • a printable representation of this object.