serg
serg

Reputation: 111365

Java: Automatic cookie handling in HttpClient?

In Java HttpClient feature list it says:

Automatic Cookie handling for reading Set-Cookie: headers from the server and sending them back out in a Cookie: header when appropriate.

But I can't figure out how to use this feature. I just need to open a web page, let it set all the cookies, then refresh the same page with received cookies.

Thanks.

Upvotes: 1

Views: 3824

Answers (1)

dharga
dharga

Reputation: 2217

I kept getting errors back from the server saying my client didn't support cookies and I should turn them on. The following line stopped those errors. Hope this works for you.

httpClient.setCookieStore(new BasicCookieStore());

Upvotes: 4

Related Questions