Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.http.client.utils
Class HttpClientUtils

    java.lang.Object
      org.apache.http.client.utils.HttpClientUtils

    public class HttpClientUtils

extends Object

Static helpers for dealing with `HttpResponse`s and `HttpClient`s.

Since:
  4.2

Method Summary
`static void` | `closeQuietly(HttpClient httpClient)` Unconditionally close a httpClient.
`static void` | `closeQuietly(HttpResponse response)` Unconditionally close a response.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### closeQuietly

    public static void closeQuietly(HttpResponse response)

  Unconditionally close a response.

  Example Code:

       HttpResponse httpResponse = null;
       try {
           httpResponse = httpClient.execute(httpGet);
       } catch (Exception e) {
           // error handling
       } finally {
           HttpClientUtils.closeQuietly(httpResponse);
       }

  Parameters:
    `response` - the HttpResponse to release resources, may be null or already closed.
  Since:
    4.2

### closeQuietly

    public static void closeQuietly(HttpClient httpClient)

  Unconditionally close a httpClient. Shuts down the underlying connection manager and releases the resources.

  Example Code:

       HttpClient httpClient = null;
       try {
         httpClient = new DefaultHttpClient(...);
       } catch (Exception e) {
         // error handling
       } finally {
         HttpClientUtils.closeQuietly(httpClient);
       }

  Parameters:
    `httpClient` - the HttpClient to close, may be null or already closed.
  Since:
    4.2

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 1999-2013 The Apache Software Foundation. All Rights Reserved.