Package org.apache.http.impl.client

Default HTTP client implementation.

See: Description

Package org.apache.http.impl.client Description

Default HTTP client implementation.

The usual execution flow can be demonstrated by the code snippet below:

 CloseableHttpClient httpclient = HttpClients.createDefault();
 try {
      HttpGet httpGet = new HttpGet("http://targethost/homepage");
      CloseableHttpResponse response = httpclient.execute(httpGet);
      try {
          System.out.println(response.getStatusLine());
          HttpEntity entity = response.getEntity();
          // do something useful with the response body
          // and ensure it is fully consumed
          EntityUtils.consume(entity);
      } finally {
          response.close();
      }
 } finally {
      httpclient.close();
 }
 

Copyright © 1999–2022 The Apache Software Foundation. All rights reserved.