문제

I would like to use AndroidHttpClient instead of DefaultHttpClient. In the documentation is say:

This client processes cookies but does not retain them by default. To retain cookies, simply add a cookie store to the HttpContext:

context.setAttribute(ClientContext.COOKIE_STORE, cookieStore);

Where do I get this context from??? Should I get it from the AndroidHttpClient or should I create it first and then pass it?

도움이 되었습니까?

해결책

AndroidHttpClient client = AndroidHttpClient.newInstance(...);
HttpContext ctx = new BasicHttpContext();
ctx.setAttribute(...);
HttpGet get = new HttpGet(...);

client.execute(get, ctx);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top