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

public Class DefaultHttpClient

extends AbstractHttpClient
Class Inheritance
Known Direct Subclasses
org.apache.http.impl.client.SystemDefaultHttpClient, org.apache.http.impl.client.ContentEncodingHttpClient
Annotations
@Contract
threading:SAFE_CONDITIONAL
@Deprecated
Imports
org.apache.http.HttpVersion, org.apache.http.annotation.Contract, .ThreadingBehavior, org.apache.http.client.protocol.RequestAddCookies, .RequestAuthCache, .RequestClientConnControl, .RequestDefaultHeaders, .RequestProxyAuthentication, .RequestTargetAuthentication, .ResponseProcessCookies, org.apache.http.conn.ClientConnectionManager, org.apache.http.params.HttpConnectionParams, .HttpParams, .HttpProtocolParams, .SyncBasicHttpParams, org.apache.http.protocol.BasicHttpProcessor, .HTTP, .RequestContent, .RequestExpectContinue, .RequestTargetHost, .RequestUserAgent, org.apache.http.util.VersionInfo

Deprecated

(4.3) use HttpClientBuilder see also CloseableHttpClient.

Default implementation of org.apache.http.client.HttpClient pre-configured for most common use scenarios.

Please see the Javadoc for createHttpProcessor() for the details of the interceptors that are set up by default.

Additional interceptors can be added as follows, but take care not to add the same interceptor more than once.

DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.addRequestInterceptor(new RequestAcceptEncoding());
httpclient.addResponseInterceptor(new ResponseContentEncoding());

This class sets up the following parameters if not explicitly set:

The following parameters can be used to customize the behavior of this class:

Since
4.0

Constructor Summary

AccessConstructor and Description
public
DefaultHttpClient(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 from parameters and a connection manager.
public
DefaultHttpClient(final ClientConnectionManager conman)

Deprecated as a consequence of ClientConnectionManager being deprecated.
public
DefaultHttpClient(final HttpParams params)

Deprecated as a consequence of HttpParams being deprecated.
public

Method Summary

Modifier and TypeMethod and Description
protected HttpParams

Returns:

a new instance of SyncBasicHttpParams with the defaults applied to it.
createHttpParams
()

Implements abstract org.apache.http.impl.client.AbstractHttpClient.createHttpParams.

Deprecated as a consequence of HttpParams being deprecated.
Creates the default set of HttpParams by invoking DefaultHttpClient#setDefaultHttpParams(HttpParams)
protected BasicHttpProcessor
public static void
setDefaultHttpParams(final HttpParams params)

Deprecated as a consequence of HttpParams being deprecated.
Saves the default set of HttpParams in the provided parameter.
Inherited from org.apache.http.impl.client.AbstractHttpClient:
addRequestInterceptoraddRequestInterceptoraddResponseInterceptoraddResponseInterceptorclearRequestInterceptorsclearResponseInterceptorsclosecreateAuthSchemeRegistrycreateClientConnectionManagercreateClientRequestDirectorcreateClientRequestDirectorcreateClientRequestDirectorcreateConnectionKeepAliveStrategycreateConnectionReuseStrategycreateCookieSpecRegistrycreateCookieStorecreateCredentialsProvidercreateHttpContextcreateHttpRequestRetryHandlercreateHttpRoutePlannercreateProxyAuthenticationHandlercreateProxyAuthenticationStrategycreateRedirectHandlercreateRequestExecutorcreateTargetAuthenticationHandlercreateTargetAuthenticationStrategycreateUserTokenHandlerdetermineParamsdoExecutegetAuthSchemesgetBackoffManagergetConnectionBackoffStrategygetConnectionKeepAliveStrategygetConnectionManagergetConnectionReuseStrategygetCookieSpecsgetCookieStoregetCredentialsProvidergetHttpProcessorgetHttpRequestRetryHandlergetParamsgetProxyAuthenticationHandlergetProxyAuthenticationStrategygetRedirectHandlergetRedirectStrategygetRequestExecutorgetRequestInterceptorgetRequestInterceptorCountgetResponseInterceptorgetResponseInterceptorCountgetRoutePlannergetTargetAuthenticationHandlergetTargetAuthenticationStrategygetUserTokenHandlerremoveRequestInterceptorByClassremoveResponseInterceptorByClasssetAuthSchemessetBackoffManagersetConnectionBackoffStrategysetCookieSpecssetCookieStoresetCredentialsProvidersetHttpRequestRetryHandlersetKeepAliveStrategysetParamssetProxyAuthenticationHandlersetProxyAuthenticationStrategysetRedirectHandlersetRedirectStrategysetReuseStrategysetRoutePlannersetTargetAuthenticationHandlersetTargetAuthenticationStrategysetUserTokenHandler

Constructor Detail

DefaultHttpClientback to summary
public DefaultHttpClient(final ClientConnectionManager conman, final HttpParams params)

Deprecated

as a consequence of ClientConnectionManager and HttpParams being deprecated. See corresponding docs for further information.

Creates a new HTTP client from parameters and a connection manager.

Parameters
conman:ClientConnectionManager

the connection manager

params:HttpParams

the parameters

DefaultHttpClientback to summary
public DefaultHttpClient(final ClientConnectionManager conman)

Deprecated

as a consequence of ClientConnectionManager being deprecated. See corresponding docs for further information.

Since
4.1
DefaultHttpClientback to summary
public DefaultHttpClient(final HttpParams params)

Deprecated

as a consequence of HttpParams being deprecated. See corresponding docs for further information.

DefaultHttpClientback to summary
public DefaultHttpClient()

Method Detail

createHttpParamsback to summary
protected HttpParams createHttpParams()

Implements abstract org.apache.http.impl.client.AbstractHttpClient.createHttpParams.

Deprecated

as a consequence of HttpParams being deprecated. See corresponding docs for further information.

Creates the default set of HttpParams by invoking DefaultHttpClient#setDefaultHttpParams(HttpParams)

Returns:HttpParams

a new instance of SyncBasicHttpParams with the defaults applied to it.

Annotations
@Override
createHttpProcessorback to summary
protected BasicHttpProcessor createHttpProcessor()

Implements abstract org.apache.http.impl.client.AbstractHttpClient.createHttpProcessor.

Deprecated

as a consequence of BasicHttpProcessor being deprecated. See corresponding docs for further information.

Create the processor with the following interceptors:

Returns:BasicHttpProcessor

the processor with the added interceptors.

Annotations
@Override
setDefaultHttpParamsback to summary
public static void setDefaultHttpParams(final HttpParams params)

Deprecated

as a consequence of HttpParams being deprecated. See corresponding docs for further information.

Saves the default set of HttpParams in the provided parameter. These are: