HttpClientBuilder
see also CloseableHttpClient
.@Contract(threading=SAFE_CONDITIONAL) @Deprecated public class DefaultHttpClient extends AbstractHttpClient
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:
CoreProtocolPNames.PROTOCOL_VERSION
CoreProtocolPNames.STRICT_TRANSFER_ENCODING
CoreProtocolPNames.HTTP_ELEMENT_CHARSET
CoreProtocolPNames.USE_EXPECT_CONTINUE
CoreProtocolPNames.WAIT_FOR_CONTINUE
CoreProtocolPNames.USER_AGENT
CoreConnectionPNames.TCP_NODELAY
CoreConnectionPNames.SO_TIMEOUT
CoreConnectionPNames.SO_LINGER
CoreConnectionPNames.SO_REUSEADDR
CoreConnectionPNames.SOCKET_BUFFER_SIZE
CoreConnectionPNames.CONNECTION_TIMEOUT
CoreConnectionPNames.MAX_LINE_LENGTH
CoreConnectionPNames.MAX_HEADER_COUNT
CoreConnectionPNames.STALE_CONNECTION_CHECK
ConnRoutePNames.FORCED_ROUTE
ConnRoutePNames.LOCAL_ADDRESS
ConnRoutePNames.DEFAULT_PROXY
CookieSpecPNames.DATE_PATTERNS
CookieSpecPNames.SINGLE_COOKIE_HEADER
AuthPNames.CREDENTIAL_CHARSET
ClientPNames.COOKIE_POLICY
ClientPNames.HANDLE_AUTHENTICATION
ClientPNames.HANDLE_REDIRECTS
ClientPNames.MAX_REDIRECTS
ClientPNames.ALLOW_CIRCULAR_REDIRECTS
ClientPNames.VIRTUAL_HOST
ClientPNames.DEFAULT_HOST
ClientPNames.DEFAULT_HEADERS
ClientPNames.CONN_MANAGER_TIMEOUT
Constructor and Description |
---|
DefaultHttpClient()
Deprecated.
|
DefaultHttpClient(ClientConnectionManager conman)
Deprecated.
|
DefaultHttpClient(ClientConnectionManager conman,
org.apache.http.params.HttpParams params)
Deprecated.
Creates a new HTTP client from parameters and a connection manager.
|
DefaultHttpClient(org.apache.http.params.HttpParams params)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
protected org.apache.http.params.HttpParams |
createHttpParams()
Deprecated.
Creates the default set of HttpParams by invoking
setDefaultHttpParams(HttpParams) |
protected org.apache.http.protocol.BasicHttpProcessor |
createHttpProcessor()
Deprecated.
Create the processor with the following interceptors:
RequestDefaultHeaders
RequestContent
RequestTargetHost
RequestClientConnControl
RequestUserAgent
RequestExpectContinue
RequestAddCookies
ResponseProcessCookies
RequestAuthCache
RequestTargetAuthentication
RequestProxyAuthentication
|
static void |
setDefaultHttpParams(org.apache.http.params.HttpParams params)
Deprecated.
Saves the default set of HttpParams in the provided parameter.
|
addRequestInterceptor, addRequestInterceptor, addResponseInterceptor, addResponseInterceptor, clearRequestInterceptors, clearResponseInterceptors, close, createAuthSchemeRegistry, createClientConnectionManager, createClientRequestDirector, createClientRequestDirector, createClientRequestDirector, createConnectionKeepAliveStrategy, createConnectionReuseStrategy, createCookieSpecRegistry, createCookieStore, createCredentialsProvider, createHttpContext, createHttpRequestRetryHandler, createHttpRoutePlanner, createProxyAuthenticationHandler, createProxyAuthenticationStrategy, createRedirectHandler, createRequestExecutor, createTargetAuthenticationHandler, createTargetAuthenticationStrategy, createUserTokenHandler, determineParams, doExecute, getAuthSchemes, getBackoffManager, getConnectionBackoffStrategy, getConnectionKeepAliveStrategy, getConnectionManager, getConnectionReuseStrategy, getCookieSpecs, getCookieStore, getCredentialsProvider, getHttpProcessor, getHttpRequestRetryHandler, getParams, getProxyAuthenticationHandler, getProxyAuthenticationStrategy, getRedirectHandler, getRedirectStrategy, getRequestExecutor, getRequestInterceptor, getRequestInterceptorCount, getResponseInterceptor, getResponseInterceptorCount, getRoutePlanner, getTargetAuthenticationHandler, getTargetAuthenticationStrategy, getUserTokenHandler, removeRequestInterceptorByClass, removeResponseInterceptorByClass, setAuthSchemes, setBackoffManager, setConnectionBackoffStrategy, setCookieSpecs, setCookieStore, setCredentialsProvider, setHttpRequestRetryHandler, setKeepAliveStrategy, setParams, setProxyAuthenticationHandler, setProxyAuthenticationStrategy, setRedirectHandler, setRedirectStrategy, setReuseStrategy, setRoutePlanner, setTargetAuthenticationHandler, setTargetAuthenticationStrategy, setUserTokenHandler
public DefaultHttpClient(ClientConnectionManager conman, org.apache.http.params.HttpParams params)
params
- the parametersconman
- the connection managerpublic DefaultHttpClient(ClientConnectionManager conman)
public DefaultHttpClient(org.apache.http.params.HttpParams params)
public DefaultHttpClient()
protected org.apache.http.params.HttpParams createHttpParams()
setDefaultHttpParams(HttpParams)
createHttpParams
in class AbstractHttpClient
SyncBasicHttpParams
with the defaults applied to it.public static void setDefaultHttpParams(org.apache.http.params.HttpParams params)
CoreProtocolPNames.PROTOCOL_VERSION
:
1.1CoreProtocolPNames.HTTP_CONTENT_CHARSET
:
ISO-8859-1CoreConnectionPNames.TCP_NODELAY
:
trueCoreConnectionPNames.SOCKET_BUFFER_SIZE
:
8192CoreProtocolPNames.USER_AGENT
:
Apache-HttpClient (Java 1.5)protected org.apache.http.protocol.BasicHttpProcessor createHttpProcessor()
RequestDefaultHeaders
RequestContent
RequestTargetHost
RequestClientConnControl
RequestUserAgent
RequestExpectContinue
RequestAddCookies
ResponseProcessCookies
RequestAuthCache
RequestTargetAuthentication
RequestProxyAuthentication
createHttpProcessor
in class AbstractHttpClient
Copyright © 1999–2022 The Apache Software Foundation. All rights reserved.