導航:首頁 > 操作系統 > androidcookiestore

androidcookiestore

發布時間:2023-09-01 13:05:04

android 怎麼從httpResponse獲取cookie

HttpRequest類和HttpResponse類提供了Cookie屬性,可以獲取你要的信息
然後你要顯示的控制項。text=這個內容

⑵ 安卓Android開發,afinal中的FinalHttp如何獲取和設置cookie

1.獲取

finalHttp = new FinalHttp();
finalHttp.post(API.server, ajaxParams, new AjaxCallBack<String>() {
@Override public void onFailure(Throwable t, int errorNo, String strMsg) { super.onFailure(t, errorNo, strMsg);
closeProgressDialog();
prompt(getResources().getString(R.string.request_time_out));
System.out.println("errorNo:" + errorNo + ",strMsg:" + strMsg);
}

@Override public void onStart() { super.onStart();
showProgressDialog(getResources().getString(R.string.loading));
}

@Override public void onLoading(long count, long current) { super.onLoading(count, current);
}

@Override public void onSuccess(String t) { super.onSuccess(t); //從伺服器獲取CookieStore,保存到MyCookieStore
DefaultHttpClient client=(DefaultHttpClient)finalHttp.getHttpClient();
MyCookieStore.cookieStore = client.getCookieStore(); if (!StringUtils.isBlank(t)) {
Log.e(TAG, Constant.RESULT + API.GET_VERIFY_CODE + " " + t.toString());
JSONStatus jsonStatus = BaseJSONData(t); if (jsonStatus.isSuccess) {
handler.sendMessage(handler.obtainMessage(GET_VERIFY_CODE_SUCCESS, BaseJSONData(t)));
} else {
handler.sendMessage(handler.obtainMessage(GET_VERIFY_CODE_FALSE, BaseJSONData(t)));
}
} else {
prompt(getResources().getString(R.string.request_no_data));
}
}
});

2.設置

OverridepublicvoidinitData() {finalHttp =newFinalHttp();//配置已保存的CookieStore,保證處於同一session中請求finalHttp.configCookieStore(MyCookieStore.cookieStore);finalHttp.post(API.server, ajaxParams,newAjaxCallBack<String>() {......(省略)}}

格式不行,湊合看吧

點贊+關注謝謝

閱讀全文

與androidcookiestore相關的資料

熱點內容
邁銳寶xl壓縮比 瀏覽:333
靠演算法買彩票 瀏覽:490
程序員考核d 瀏覽:237
自助游中國pdf 瀏覽:739
安卓p40是什麼手機 瀏覽:80
24cxx編程器 瀏覽:584
陰陽師如何查看哪個伺服器有ID 瀏覽:309
公務員照片壓縮 瀏覽:451
編譯的時候怎麼找未定義的函數 瀏覽:345
有什麼我的世界伺服器 瀏覽:299
伺服器亮綠燈是什麼意思 瀏覽:630
python畫的圖如何保存高清版 瀏覽:492
10的搭接還用加密嗎 瀏覽:366
bytedance這個文件夾是什麼意思呢 瀏覽:591
演算法站的客體 瀏覽:79
src文件夾c語言怎麼運行 瀏覽:26
怎麼把已安裝的app放到桌面 瀏覽:949
如何查看蘋果手機app是否取消訂閱 瀏覽:775
u盤加密之後手機可以打開嗎 瀏覽:48
單片機串口發射怎麼回事 瀏覽:480