Package org.apache.http.impl.client
package org.apache.http.impl.client
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();
}
-
ClassesClassDescriptionThe
AIMDBackoffManagerapplies an additive increase, multiplicative decrease (AIMD) to managing a dynamic limit to the number of connections allowed to a given host.Default implementation ofAuthCache.Default implementation ofCookieStoreDefault implementation ofCredentialsProvider.AResponseHandlerthat returns the response body as a String for successful (2xx) responses.Base implementation ofHttpClientthat also implementsCloseable.ThisConnectionBackoffStrategybacks off either for a raw network socket or connection timeout or if the server explicitly sends a 503 (Service Unavailable) response.Default implementation of a strategy deciding duration that a connection can remain idle.The defaultHttpRequestRetryHandlerused by request executors.Default implementation ofRedirectStrategy.Default implementation of theServiceUnavailableRetryStrategyinterface.Default implementation ofUserTokenHandler.Deprecated.(4.3) do not use.Collection of different counters used to gather metrics forFutureRequestExecutionService.HttpAsyncClientWithFuture wraps calls to execute with aHttpRequestFutureTaskand schedules them using the provided executor service.Builder forCloseableHttpClientinstances.Factory methods forCloseableHttpClientinstances.FutureTask implementation that wraps a HttpAsyncClientCallable and exposes various task specific metrics.LaxRedirectStrategyimplementation that automatically redirects all HEAD, GET and POST requests.Noop implementation ofUserTokenHandlerthat always returnsnull.This is aConnectionBackoffStrategythat never backs off, for compatibility with existing behavior.DefaultAuthenticationStrategyimplementation for proxy host authentication.ProxyClient can be used to establish a tunnel via an HTTP proxy.This class represents a collection ofURIs used as redirect locations.Deprecated.(4.3) do not use.HttpRequestRetryHandlerwhich assumes that all requested HTTP methods which should be idempotent according to RFC-2616 are in fact idempotent and can be retried.Implementation ofCredentialsProviderbacked by standard JREAuthenticator.DefaultAuthenticationStrategyimplementation for proxy host authentication.