public class PersistentCookieStore extends java.lang.Object implements CookieStore
OkHttpClient client = new OkHttpClient.Builder()
.cookieJar(new JavaNetCookieJar(new CookieManager(
new PersistentCookieStore(getApplicationContext()),
CookiePolicy.ACCEPT_ALL))
.build();
from http://stackoverflow.com/questions/25461792/persistent-cookie-store-using-okhttp-2-on-android
| 构造器和说明 |
|---|
PersistentCookieStore(android.content.Context context)
Construct a persistent cookie store.
|
| 限定符和类型 | 方法和说明 |
|---|---|
protected void |
add(okhttp3.HttpUrl uri,
okhttp3.Cookie cookie) |
void |
add(okhttp3.HttpUrl uri,
java.util.List<okhttp3.Cookie> cookies) |
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.
|
protected okhttp3.Cookie |
decodeCookie(java.lang.String cookieString) |
protected java.lang.String |
encodeCookie(SerializableHttpCookie cookie) |
java.util.List<okhttp3.Cookie> |
get(okhttp3.HttpUrl uri) |
java.util.List<okhttp3.Cookie> |
getCookies() |
protected java.lang.String |
getCookieToken(okhttp3.Cookie cookie) |
protected byte[] |
hexStringToByteArray(java.lang.String hexString)
Converts hex values from strings to byte arra
|
boolean |
remove(okhttp3.HttpUrl uri,
okhttp3.Cookie cookie) |
boolean |
removeAll() |
public PersistentCookieStore(android.content.Context context)
context - Context to attach cookie store toprotected void add(okhttp3.HttpUrl uri,
okhttp3.Cookie cookie)
protected java.lang.String getCookieToken(okhttp3.Cookie cookie)
public void add(okhttp3.HttpUrl uri,
java.util.List<okhttp3.Cookie> cookies)
add 在接口中 CookieStorepublic java.util.List<okhttp3.Cookie> get(okhttp3.HttpUrl uri)
get 在接口中 CookieStorepublic boolean removeAll()
removeAll 在接口中 CookieStorepublic boolean remove(okhttp3.HttpUrl uri,
okhttp3.Cookie cookie)
remove 在接口中 CookieStorepublic java.util.List<okhttp3.Cookie> getCookies()
getCookies 在接口中 CookieStoreprotected java.lang.String encodeCookie(SerializableHttpCookie cookie)
protected okhttp3.Cookie decodeCookie(java.lang.String cookieString)
protected java.lang.String byteArrayToHexString(byte[] bytes)
bytes - byte array to be convertedprotected byte[] hexStringToByteArray(java.lang.String hexString)
hexString - string of hex-encoded values