Package org.apache.http.impl.client
Class BasicCookieStore
java.lang.Object
org.apache.http.impl.client.BasicCookieStore
- All Implemented Interfaces:
CookieStore
public class BasicCookieStore extends Object implements CookieStore
Default implementation of
CookieStore- Since:
- 4.0
- Author:
- Remy Maucherat, Rodney Waldhoff, Jeff Dever, Sean C. Sullivan, Michael Becke, Oleg Kalnichevski, Mike Bowler, Adrian Sutton
-
Constructor Summary
Constructors Constructor Description BasicCookieStore()Default constructor. -
Method Summary
Modifier and Type Method Description voidaddCookie(Cookie cookie)Adds anHTTP cookie, replacing any existing equivalent cookies.voidaddCookies(Cookie[] cookies)Adds an array ofHTTP cookies.voidclear()Clears all cookies.booleanclearExpired(Date date)List<Cookie>getCookies()Returns an immutable array ofcookiesthat this HTTP state currently contains.StringtoString()Returns a string containing a concise, human-readable description of this object.
-
Constructor Details
-
BasicCookieStore
public BasicCookieStore()Default constructor.
-
-
Method Details
-
addCookie
Adds anHTTP 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.- Specified by:
addCookiein interfaceCookieStore- Parameters:
cookie- thecookieto be added- See Also:
addCookies(Cookie[])
-
addCookies
Adds an array ofHTTP 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- thecookiesto be added- See Also:
addCookie(Cookie)
-
getCookies
Returns an immutable array ofcookiesthat this HTTP state currently contains.- Specified by:
getCookiesin interfaceCookieStore- Returns:
- an array of
cookies.
-
clearExpired
- Specified by:
clearExpiredin interfaceCookieStore- Returns:
- true if any cookies were purged.
- See Also:
Cookie.isExpired(Date)
-
toString
Description copied from class:ObjectReturns 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
toStringmethod if you intend implementing your owntoStringmethod. -
clear
public void clear()Clears all cookies.- Specified by:
clearin interfaceCookieStore
-