关于 LoopJ AndroidAsyncHttp示例,我提出了这样的获取请求:
final TextView text = (TextView) findViewById(R.id.textView);
AsyncHttpClient client = new AsyncHttpClient();
client.get("http://example.com/mypage/", new AsyncHttpResponseHandler() {
@Override
public void onSuccess(String response) {
text.append(response);
}
});
我还添加了 cookie:
PersistentCookieStore myCookieStore = new PersistentCookieStore(this);
client.setCookieStore(myCookieStore);
BasicClientCookie newCookie = new BasicClientCookie("id", 17882);
myCookieStore.addCookie(newCookie);
但是在发出 GET 请求时,如何在请求对象中发送我的 cookie?
关于文档客户端具有以下方法签名:
void get(Context context, String url, AsyncHttpResponseHandler responseHandler)
void get(Context context, String url, Header[] headers, RequestParams params, AsyncHttpResponseHandler responseHandler)
void get(Context context, String url, RequestParams params, AsyncHttpResponseHandler responseHandler)
void get(String url, AsyncHttpResponseHandler responseHandler)
void get(String url, RequestParams params, AsyncHttpResponseHandler responseHandler)
如果您能举一个在 GET 请求中发送持久 cookie 的示例,我会很高兴。