Android APIs
Added in API level 1
Deprecated since API level 22
public class

BasicCookieStore

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

This class was deprecated in API level 22.
Please use openConnection() instead. Please visit this webpage for further details.

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 ()

Added in API level 1

Default constructor.

Public Methods

public synchronized void addCookie (Cookie cookie)

Added in 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)

Added in 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 ()

Added in API level 1

Clears all cookies.

public synchronized boolean clearExpired (Date date)

Added in 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 ()

Added in API level 1

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

Returns

public String toString ()

Added in 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 is equivalent to the following expression:

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

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.