I am using HttpClient 4.1.2
HttpGet httpget = new HttpGet(uri);
HttpResponse response = httpClient.execute(httpget);
So, how can I get the cookie values?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Please Note: The first link points to something that used to work in HttpClient V3. Find V4-related info below.
This should answer your question
http://www.java2s.com/Code/Java/Apache-Common/GetCookievalueandsetcookievalue.htm
The following is relevant for V4:
…in addition, the javadocs should contain more information on cookie handling
http://hc.apache.org/httpcomponents-client-ga/httpclient/apidocs/index.html
and here is a tutorial for httpclient v4:
http://hc.apache.org/httpcomponents-client-ga/tutorial/html/index.html
And here is some pseudo-code that helps (I hope, it’s based only on docs):
Please make sure you read the javadocs for ResponseProcessCookies and AbstractHttpClient.