|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.http.client.utils.HttpClientUtils
public class HttpClientUtils
Static helpers for dealing with HttpResponse
s.
Method Summary | |
---|---|
static void |
closeQuietly(CloseableHttpClient httpClient)
Unconditionally close a httpClient. |
static void |
closeQuietly(CloseableHttpResponse response)
Unconditionally close a response. |
static void |
closeQuietly(HttpClient httpClient)
Deprecated. (4.3) do not use. |
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 |
---|
public static void closeQuietly(HttpResponse response)
Example Code:
HttpResponse httpResponse = null; try { httpResponse = httpClient.execute(httpGet); } catch (Exception e) { // error handling } finally { HttpClientUtils.closeQuietly(httpResponse); }
response
- the HttpResponse to release resources, may be null or already
closed.public static void closeQuietly(CloseableHttpResponse response)
Example Code:
HttpResponse httpResponse = null; try { httpResponse = httpClient.execute(httpGet); } catch (Exception e) { // error handling } finally { HttpClientUtils.closeQuietly(httpResponse); }
response
- the HttpResponse to release resources, may be null or already
closed.@Deprecated public static void closeQuietly(HttpClient httpClient)
Example Code:
HttpClient httpClient = null; try { httpClient = new DefaultHttpClient(...); } catch (Exception e) { // error handling } finally { HttpClientUtils.closeQuietly(httpClient); }
httpClient
- the HttpClient to close, may be null or already closed.public static void closeQuietly(CloseableHttpClient httpClient)
Example Code:
CloseableHttpClient httpClient = HttpClients.createDefault(); try { ... } catch (Exception e) { // error handling } finally { HttpClientUtils.closeQuietly(httpClient); }
httpClient
- the HttpClient to close, may be null or already closed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |