com.loopj.android.http
Class PersistentCookieStore

java.lang.Object
  extended by com.loopj.android.http.PersistentCookieStore
All Implemented Interfaces:
CookieStore

public class PersistentCookieStore
extends Object
implements CookieStore

A persistent cookie store which implements the Apache HttpClient CookieStore interface. Cookies are stored and will persist on the user's device between application sessions since they are serialized and stored in SharedPreferences.

Instances of this class are designed to be used with AsyncHttpClient.setCookieStore(org.apache.http.client.CookieStore), but can also be used with a regular old apache HttpClient/HttpContext if you prefer.


Constructor Summary
PersistentCookieStore(Context context)
          Construct a persistent cookie store.
 
Method Summary
 void addCookie(Cookie cookie)
           
protected  String byteArrayToHexString(byte[] b)
           
 void clear()
           
 boolean clearExpired(Date date)
           
protected  Cookie decodeCookie(String cookieStr)
           
protected  String encodeCookie(SerializableCookie cookie)
           
 List<Cookie> getCookies()
           
protected  byte[] hexStringToByteArray(String s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentCookieStore

public PersistentCookieStore(Context context)
Construct a persistent cookie store.

Method Detail

addCookie

public void addCookie(Cookie cookie)
Specified by:
addCookie in interface CookieStore

clear

public void clear()
Specified by:
clear in interface CookieStore

clearExpired

public boolean clearExpired(Date date)
Specified by:
clearExpired in interface CookieStore

getCookies

public List<Cookie> getCookies()
Specified by:
getCookies in interface CookieStore

encodeCookie

protected String encodeCookie(SerializableCookie cookie)

decodeCookie

protected Cookie decodeCookie(String cookieStr)

byteArrayToHexString

protected String byteArrayToHexString(byte[] b)

hexStringToByteArray

protected byte[] hexStringToByteArray(String s)