Top Description Fields Constructors Methods
org.apache.http.impl.client

public abstract Class AbstractHttpClient

extends CloseableHttpClient
Class Inheritance
Known Direct Subclasses
org.apache.http.impl.client.DefaultHttpClient
Annotations
@Contract
threading:SAFE_CONDITIONAL
@Deprecated
Imports
java.io.IOException, java.lang.reflect.UndeclaredThrowableException, org.apache.commons.logging.Log, .LogFactory, org.apache.http.ConnectionReuseStrategy, .HttpException, .HttpHost, .HttpRequest, .HttpRequestInterceptor, .HttpResponseInterceptor, org.apache.http.annotation.Contract, .ThreadingBehavior, org.apache.http.auth.AuthSchemeRegistry, org.apache.http.client.AuthenticationHandler, .AuthenticationStrategy, .BackoffManager, .ClientProtocolException, .ConnectionBackoffStrategy, .CookieStore, .CredentialsProvider, .HttpRequestRetryHandler, .RedirectHandler, .RedirectStrategy, .RequestDirector, .UserTokenHandler, org.apache.http.client.config.CookieSpecs, .RequestConfig, org.apache.http.client.methods.CloseableHttpResponse, org.apache.http.client.params.AuthPolicy, .ClientPNames, .CookiePolicy, .HttpClientParamConfig, org.apache.http.client.protocol.ClientContext, org.apache.http.conn.ClientConnectionManager, .ClientConnectionManagerFactory, .ConnectionKeepAliveStrategy, org.apache.http.conn.routing.HttpRoute, .HttpRoutePlanner, org.apache.http.conn.scheme.SchemeRegistry, org.apache.http.cookie.CookieSpecRegistry, org.apache.http.impl.DefaultConnectionReuseStrategy, org.apache.http.impl.auth.BasicSchemeFactory, .DigestSchemeFactory, .KerberosSchemeFactory, .NTLMSchemeFactory, .SPNegoSchemeFactory, org.apache.http.impl.conn.BasicClientConnectionManager, .DefaultHttpRoutePlanner, .SchemeRegistryFactory, org.apache.http.impl.cookie.BestMatchSpecFactory, .BrowserCompatSpecFactory, .IgnoreSpecFactory, .NetscapeDraftSpecFactory, .RFC2109SpecFactory, .RFC2965SpecFactory, org.apache.http.params.HttpParams, org.apache.http.protocol.BasicHttpContext, .BasicHttpProcessor, .DefaultedHttpContext, .HttpContext, .HttpProcessor, .HttpRequestExecutor, .ImmutableHttpProcessor, org.apache.http.util.Args

Deprecated

(4.3) use HttpClientBuilder.

Base class for org.apache.http.client.HttpClient implementations. This class acts as a facade to a number of special purpose handler or strategy implementations responsible for handling of a particular aspect of the HTTP protocol such as redirect or authentication handling or making decision about connection persistence and keep alive duration. This enables the users to selectively replace default implementation of those aspects with custom, application specific ones. This class also provides factory methods to instantiate those objects:

This class also maintains a list of protocol interceptors intended for processing outgoing requests and incoming responses and provides methods for managing those interceptors. New protocol interceptors can be introduced to the protocol processor chain or removed from it if needed. Internally protocol interceptors are stored in a simple java.util.ArrayList. They are executed in the same natural order as they are added to the list.

AbstractHttpClient is thread safe. It is recommended that the same instance of this class is reused for multiple request executions. When an instance of DefaultHttpClient is no longer needed and is about to go out of scope the connection manager associated with it must be shut down by calling ClientConnectionManager#shutdown()!

Since
4.0

Field Summary

Modifier and TypeField and Description
private BackoffManager
private ConnectionBackoffStrategy
private ClientConnectionManager
connManager

Deprecated as a consequence of ClientConnectionManager being deprecated.
private CookieStore
private CredentialsProvider
private HttpParams
defaultParams

Deprecated as a consequence of HttpParams being deprecated.
private ConnectionKeepAliveStrategy
private final Log
private BasicHttpProcessor
mutableProcessor

Deprecated as a consequence of BasicHttpProcessor being deprecated.
private ImmutableHttpProcessor
private AuthenticationStrategy
private RedirectStrategy
private HttpRequestExecutor
private HttpRequestRetryHandler
private ConnectionReuseStrategy
private HttpRoutePlanner
private AuthSchemeRegistry
supportedAuthSchemes

Deprecated as a consequence of AuthSchemeRegistry being deprecated.
private CookieSpecRegistry
supportedCookieSpecs

Deprecated as a consequence of CookieSpecRegistry being deprecated.
private AuthenticationStrategy
private UserTokenHandler

Constructor Summary

AccessConstructor and Description
protected
AbstractHttpClient(final ClientConnectionManager
the connection manager
conman
,
final HttpParams
the parameters
params
)

Deprecated as a consequence of ClientConnectionManager and HttpParams being deprecated.
Creates a new HTTP client.

Method Summary

Modifier and TypeMethod and Description
public synchronized void
public synchronized void
addRequestInterceptor(final HttpRequestInterceptor itcp, final int index)

public synchronized void
public synchronized void
addResponseInterceptor(final HttpResponseInterceptor itcp, final int index)

public synchronized void
public synchronized void
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.
protected AuthSchemeRegistry
createAuthSchemeRegistry()

Deprecated as a consequence of AuthSchemeRegistry being deprecated.
protected ClientConnectionManager
createClientConnectionManager()

Deprecated as a consequence of ClientConnectionManager being deprecated.
protected RequestDirector
createClientRequestDirector(final HttpRequestExecutor requestExec, final ClientConnectionManager conman, final ConnectionReuseStrategy reustrat, final ConnectionKeepAliveStrategy kastrat, final HttpRoutePlanner rouplan, final HttpProcessor httpProcessor, final HttpRequestRetryHandler retryHandler, final RedirectHandler redirectHandler, final AuthenticationHandler targetAuthHandler, final AuthenticationHandler proxyAuthHandler, final UserTokenHandler userTokenHandler, final HttpParams params)

Deprecated (4.1) do not use
protected RequestDirector
createClientRequestDirector(final HttpRequestExecutor requestExec, final ClientConnectionManager conman, final ConnectionReuseStrategy reustrat, final ConnectionKeepAliveStrategy kastrat, final HttpRoutePlanner rouplan, final HttpProcessor httpProcessor, final HttpRequestRetryHandler retryHandler, final RedirectStrategy redirectStrategy, final AuthenticationHandler targetAuthHandler, final AuthenticationHandler proxyAuthHandler, final UserTokenHandler userTokenHandler, final HttpParams params)

Deprecated (4.2) do not use
protected RequestDirector
createClientRequestDirector(final HttpRequestExecutor requestExec, final ClientConnectionManager conman, final ConnectionReuseStrategy reustrat, final ConnectionKeepAliveStrategy kastrat, final HttpRoutePlanner rouplan, final HttpProcessor httpProcessor, final HttpRequestRetryHandler retryHandler, final RedirectStrategy redirectStrategy, final AuthenticationStrategy targetAuthStrategy, final AuthenticationStrategy proxyAuthStrategy, final UserTokenHandler userTokenHandler, final HttpParams params)

Deprecated as a consequence of ClientConnectionManager, HttpParams and RequestDirector being deprecated.
protected ConnectionKeepAliveStrategy
protected ConnectionReuseStrategy
protected CookieSpecRegistry
createCookieSpecRegistry()

Deprecated as a consequence of CookieSpecRegistry being deprecated.
protected CookieStore
protected CredentialsProvider
protected HttpContext
protected abstract HttpParams
createHttpParams()

Deprecated as a consequence of HttpParams being deprecated.
protected abstract BasicHttpProcessor
createHttpProcessor()

Deprecated as a consequence of BasicHttpProcessor being deprecated.
protected HttpRequestRetryHandler
protected HttpRoutePlanner
protected AuthenticationHandler
createProxyAuthenticationHandler()

Deprecated (4.2) do not use
protected AuthenticationStrategy
protected RedirectHandler
createRedirectHandler()

Deprecated (4.1) do not use
protected HttpRequestExecutor
protected AuthenticationHandler
createTargetAuthenticationHandler()

Deprecated (4.2) do not use
protected AuthenticationStrategy
protected UserTokenHandler
protected HttpParams

Returns:

the parameters to use
determineParams
(final HttpRequest
the request that will be executed
req
)

Deprecated as a consequence of HttpParams being deprecated.
Obtains parameters for executing a request.
protected final CloseableHttpResponse
doExecute(final HttpHost target, final HttpRequest request, final HttpContext context)

Implements abstract org.apache.http.impl.client.CloseableHttpClient.doExecute.

public final synchronized AuthSchemeRegistry
getAuthSchemes()

Deprecated as a consequence of AuthSchemeRegistry being deprecated.
public final synchronized BackoffManager
public final synchronized ConnectionBackoffStrategy
public final synchronized ConnectionKeepAliveStrategy
public final synchronized ClientConnectionManager
getConnectionManager()

Implements org.apache.http.client.HttpClient.getConnectionManager.

Deprecated as a consequence of ClientConnectionManager being deprecated.
Obtains the connection manager used by this client.
public final synchronized ConnectionReuseStrategy
public final synchronized CookieSpecRegistry
getCookieSpecs()

Deprecated as a consequence of CookieSpecRegistry being deprecated.
public final synchronized CookieStore
public final synchronized CredentialsProvider
protected final synchronized BasicHttpProcessor
getHttpProcessor()

Deprecated as a consequence of BasicHttpProcessor being deprecated.
public final synchronized HttpRequestRetryHandler
public final synchronized HttpParams
getParams()

Implements org.apache.http.client.HttpClient.getParams.

Deprecated as a consequence of HttpParams being deprecated.
Obtains the parameters for this client.
private synchronized HttpProcessor
public final synchronized AuthenticationHandler
getProxyAuthenticationHandler()

Deprecated (4.2) do not use
public final synchronized AuthenticationStrategy
public final synchronized RedirectHandler
getRedirectHandler()

Deprecated (4.1) do not use
public final synchronized RedirectStrategy
public final synchronized HttpRequestExecutor
public synchronized HttpRequestInterceptor
getRequestInterceptor(final int index)

public synchronized int
public synchronized HttpResponseInterceptor
getResponseInterceptor(final int index)

public synchronized int
public final synchronized HttpRoutePlanner
public final synchronized AuthenticationHandler
getTargetAuthenticationHandler()

Deprecated (4.2) do not use
public final synchronized AuthenticationStrategy
public final synchronized UserTokenHandler
public synchronized void
public synchronized void
public synchronized void
setAuthSchemes(final AuthSchemeRegistry registry)

Deprecated as a consequence of AuthSchemeRegistry being deprecated.
public synchronized void
public synchronized void
public synchronized void
setCookieSpecs(final CookieSpecRegistry registry)

Deprecated as a consequence of CookieSpecRegistry being deprecated.
public synchronized void
setCookieStore(final CookieStore cookieStore)

public synchronized void
public synchronized void
public synchronized void
public synchronized void
setParams(final HttpParams
the new default parameters
params
)

Deprecated as a consequence of HttpParams being deprecated.
Replaces the parameters.
public synchronized void
setProxyAuthenticationHandler(final AuthenticationHandler handler)

Deprecated (4.2) do not use
public synchronized void
public synchronized void
setRedirectHandler(final RedirectHandler handler)

Deprecated (4.1) do not use
public synchronized void
public synchronized void
public synchronized void
setRoutePlanner(final HttpRoutePlanner routePlanner)

public synchronized void
setTargetAuthenticationHandler(final AuthenticationHandler handler)

Deprecated (4.2) do not use
public synchronized void
public synchronized void
Inherited from org.apache.http.impl.client.CloseableHttpClient:
executeexecuteexecuteexecuteexecuteexecuteexecuteexecute