【发布时间】:2012-11-26 14:41:28
【问题描述】:
我正在尝试为网站制作应用程序。登录工作正常,但是当我现在尝试发送 GET 请求时,不会发送会话 ID cookie。带有 CookieStorage 的 HttpContext 是这样设置的:
public static final HttpContext LOCALCONTEXT = new BasicHttpContext();
LOCALCONTEXT.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
那是登录:
HttpResponse response = httpclient.execute(httppost, LOCALCONTEXT);
这就是 GET 请求:
HttpResponse response = httpclient.execute(httpGet, LoginActivity.LOCALCONTEXT);.
与
Log.d(LoginActivity.NAME, "Cookie1:= " + LoginActivity.LOCALCONTEXT.getAttribute(ClientContext.COOKIE_STORE).toString());
我在 GET 请求之前和之后记录了保存的 cookie。他们是正确的。但是我嗅到了模拟器的流量并且没有发送cookie。 为什么?
【问题讨论】:
标签: java android cookies httpclient cookiestore