use of com.lzy.okgo.cookie.store.CookieStore in project okhttp-OkGo by jeasonlzy.
the class CookieActivity method removeCookie.
@OnClick(R.id.removeCookie)
public void removeCookie(View view) {
HttpUrl httpUrl = HttpUrl.parse(Urls.URL_METHOD);
CookieStore cookieStore = OkGo.getInstance().getCookieJar().getCookieStore();
cookieStore.removeCookie(httpUrl);
showToast("详细移除cookie的代码,请看demo的代码");
}
use of com.lzy.okgo.cookie.store.CookieStore 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.lzy.okgo.cookie.store.CookieStore 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.lzy.okgo.cookie.store.CookieStore in project okhttp-OkGo by jeasonlzy.
the class CookieActivity method addCookie.
@OnClick(R.id.addCookie)
public void addCookie(View view) {
HttpUrl httpUrl = HttpUrl.parse(Urls.URL_METHOD);
Cookie.Builder builder = new Cookie.Builder();
Cookie cookie = builder.name("myCookieKey1").value("myCookieValue1").domain(httpUrl.host()).build();
CookieStore cookieStore = OkGo.getInstance().getCookieJar().getCookieStore();
cookieStore.saveCookie(httpUrl, cookie);
showToast("详细添加cookie的代码,请看demo的代码");
//
OkGo.post(Urls.URL_TEXT_UPLOAD).tag(//
this).execute(new StringDialogCallback(this) {
@Override
public void onSuccess(String s, Call call, Response response) {
handleResponse(s, call, response);
}
@Override
public void onError(Call call, Response response, Exception e) {
super.onError(call, response, e);
handleError(call, response);
}
});
}
Aggregations