public class HttpClientUtils extends Object
Modifier | Constructor and Description |
---|---|
private |
HttpClientUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
closeQuietly(CloseableHttpResponse response)
Unconditionally close a response.
|
static void |
closeQuietly(HttpClient httpClient)
Unconditionally close a httpClient.
|
static void |
closeQuietly(HttpResponse response)
Unconditionally close a response.
|
private HttpClientUtils()
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.public static void closeQuietly(HttpClient httpClient)
Example Code:
HttpClient httpClient = HttpClients.createDefault(); try { httpClient.execute(request); } catch (Exception e) { // error handling } finally { HttpClientUtils.closeQuietly(httpClient); }
httpClient
- the HttpClient to close, may be null or already closed.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses