Linked Questions

Popular Questions

How to get cookie list using httpclient version 4.5.7

Asked by At

I am using Httpclient version 4.5.7.

How to get the cookie list from an httpresponse in the latest version?

I have previously used version 4.1. It supports AbstractHttpClient through which I can access getCookieStore to get the cookie list.

Now I changed to the latest version in which I saw AbstractHttpClient is deprecated.

My code:

    String url="";
    HttpClient c=HttpClientBuilder.create().build();
    HttpPost p=new HttpPost(url);
    List<NameValuePair> l=new ArrayList<NameValuePair>();
    l.add(new BasicNameValuePair("uname", "xyz"));
    l.add(new BasicNameValuePair("pwd", "abc"));
    p.setEntity(new UrlEncodedFormEntity(l));
    HttpResponse response=c.execute(p);

Related Questions