use of com.firenio.codec.http11.Cookie in project AndroidFrame by tongxiaoyun.
the class SharedPrefsCookiePersistor method removeAll.
@Override
public void removeAll(Collection<Cookie> cookies) {
SharedPreferences.Editor editor = sharedPreferences.edit();
for (Cookie cookie : cookies) {
editor.remove(createCookieKey(cookie));
}
editor.commit();
}
use of com.firenio.codec.http11.Cookie in project Atom_Android by Rogrand-Dev.
the class PersistentCookieStore method decodeCookie.
/**
* 将字符串反序列化成cookies
*
* @param cookieString cookies string
* @return cookie object
*/
protected Cookie decodeCookie(String cookieString) {
byte[] bytes = hexStringToByteArray(cookieString);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
Cookie cookie = null;
try {
ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
cookie = ((OkHttpCookies) objectInputStream.readObject()).getCookies();
} catch (IOException e) {
Log.d(TAG, "IOException in decodeCookie", e);
} catch (ClassNotFoundException e) {
Log.d(TAG, "ClassNotFoundException in decodeCookie", e);
}
return cookie;
}
use of com.firenio.codec.http11.Cookie in project okhttp-OkGo by jeasonlzy.
the class CookieActivity method getCookie.
@OnClick(R.id.getCookie)
public void getCookie(View view) {
// 一般手动取出cookie的目的只是交给 webview 等等,非必要情况不要自己操作
CookieStore cookieStore = OkGo.getInstance().getCookieJar().getCookieStore();
HttpUrl httpUrl = HttpUrl.parse(Urls.URL_METHOD);
List<Cookie> cookies = cookieStore.getCookie(httpUrl);
showToast(httpUrl.host() + "对应的cookie如下:" + cookies.toString());
}
use of com.firenio.codec.http11.Cookie in project okhttp-OkGo by jeasonlzy.
the class CookieActivity method getAllCookie.
@OnClick(R.id.getAllCookie)
public void getAllCookie(View view) {
// 一般手动取出cookie的目的只是交给 webview 等等,非必要情况不要自己操作
CookieStore cookieStore = OkGo.getInstance().getCookieJar().getCookieStore();
List<Cookie> allCookie = cookieStore.getAllCookie();
showToast("所有cookie如下:" + allCookie.toString());
}
use of com.firenio.codec.http11.Cookie in project okhttp-OkGo by jeasonlzy.
the class SerializableCookie method bytesToCookie.
public static Cookie bytesToCookie(byte[] bytes) {
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
Cookie cookie = null;
try {
ObjectInputStream objectInputStream = new ObjectInputStream(byteArrayInputStream);
cookie = ((SerializableCookie) objectInputStream.readObject()).getCookie();
} catch (Exception e) {
OkLogger.printStackTrace(e);
}
return cookie;
}
Aggregations