Search code examples
javahttpclienthttpresponse

HttpClient examples with HttpResponse


import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
//...
HttpClient client = new DefaultHttpClient();
HttpGet get = new HttpGet(url);
HttpResponse response = client.execute(url);

I use the following external libraries:

  • httpclient-4.1.2
  • commons-codec-1.4
  • commons-logging-1.1.1

In all HttpClient examples from here they use the HttpResponse but I can't find any class to import for the HttpResponse. Can you help me?


Solution

  • HttpResponse lives in HttpCore (docs).

    They're both part of HttpComponents.