Class DefaultHttpClient

All Implemented Interfaces:
Closeable, AutoCloseable, HttpClient
Direct Known Subclasses:
ContentEncodingHttpClient, SystemDefaultHttpClient

@Contract(threading=SAFE_CONDITIONAL) @Deprecated public class DefaultHttpClient extends AbstractHttpClient
Deprecated.
Default implementation of 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:

  • Version: HttpVersion.HTTP_1_1
  • ContentCharset: HTTP.DEFAULT_CONTENT_CHARSET
  • NoTcpDelay: true
  • SocketBufferSize: 8192
  • UserAgent: Apache-HttpClient/release (java 1.5)

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

Since:
4.0
  • Constructor Details

    • DefaultHttpClient

      public DefaultHttpClient(ClientConnectionManager conman, org.apache.http.params.HttpParams params)
      Deprecated.
      Creates a new HTTP client from parameters and a connection manager.
      Parameters:
      conman - the connection manager
      params - the parameters
    • DefaultHttpClient

      public DefaultHttpClient(ClientConnectionManager conman)
      Deprecated.
      Since:
      4.1
    • DefaultHttpClient

      public DefaultHttpClient(org.apache.http.params.HttpParams params)
      Deprecated.
    • DefaultHttpClient

      public DefaultHttpClient()
      Deprecated.
  • Method Details