Question

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?

Was it helpful?

Solution

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

client.execute(get, ctx);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top