public class PersistentCookieStore
extends java.lang.Object
implements cz.msebera.android.httpclient.client.CookieStore
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(cz.msebera.android.httpclient.client.CookieStore), but can also be used with a
regular old apache HttpClient/HttpContext if you prefer.| Constructor and Description |
|---|
PersistentCookieStore(android.content.Context context)
Construct a persistent cookie store.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCookie(cz.msebera.android.httpclient.cookie.Cookie cookie) |
protected java.lang.String |
byteArrayToHexString(byte[] bytes)
Using some super basic byte array <-> hex conversions so we don't have to rely on any
large Base64 libraries.
|
void |
clear() |
boolean |
clearExpired(java.util.Date date) |
protected cz.msebera.android.httpclient.cookie.Cookie |
decodeCookie(java.lang.String cookieString)
Returns cookie decoded from cookie string
|
void |
deleteCookie(cz.msebera.android.httpclient.cookie.Cookie cookie)
Non-standard helper method, to delete cookie
|
protected java.lang.String |
encodeCookie(SerializableCookie cookie)
Serializes Cookie object into String
|
java.util.List<cz.msebera.android.httpclient.cookie.Cookie> |
getCookies() |
protected byte[] |
hexStringToByteArray(java.lang.String hexString)
Converts hex values from strings to byte arra
|
void |
setOmitNonPersistentCookies(boolean omitNonPersistentCookies)
Will make PersistentCookieStore instance ignore Cookies, which are non-persistent by
signature (`Cookie.isPersistent`)
|
public PersistentCookieStore(android.content.Context context)
context - Context to attach cookie store topublic void addCookie(cz.msebera.android.httpclient.cookie.Cookie cookie)
addCookie in interface cz.msebera.android.httpclient.client.CookieStorepublic void clear()
clear in interface cz.msebera.android.httpclient.client.CookieStorepublic boolean clearExpired(java.util.Date date)
clearExpired in interface cz.msebera.android.httpclient.client.CookieStorepublic java.util.List<cz.msebera.android.httpclient.cookie.Cookie> getCookies()
getCookies in interface cz.msebera.android.httpclient.client.CookieStorepublic void setOmitNonPersistentCookies(boolean omitNonPersistentCookies)
omitNonPersistentCookies - true if non-persistent cookies should be omitedpublic void deleteCookie(cz.msebera.android.httpclient.cookie.Cookie cookie)
cookie - cookie to be removedprotected java.lang.String encodeCookie(SerializableCookie cookie)
cookie - cookie to be encoded, can be nullprotected cz.msebera.android.httpclient.cookie.Cookie decodeCookie(java.lang.String cookieString)
cookieString - string of cookie as returned from http requestprotected java.lang.String byteArrayToHexString(byte[] bytes)
bytes - byte array to be convertedprotected byte[] hexStringToByteArray(java.lang.String hexString)
hexString - string of hex-encoded values