This example demonstrates how to process HTTP responses using a response handler. This is the recommended way of executing HTTP requests and processing HTTP responses. This approach enables the caller to concentrate on the process of digesting HTTP responses and to delegate the task of system resource deallocation to HttpClient. The use of an HTTP response handler guarantees that the underlying HTTP connection will be released back to the connection manager automatically in all cases.
This example demonstrates how to ensure the release of the underlying HTTP connection back to the connection manager in case of a manual processing of HTTP responses.
This example demonstrates how to abort an HTTP request before its normal completion.
This example uses HttpClient to execute an HTTP request against a target site that requires user authentication.
This example demonstrates how to send an HTTP request via a proxy.
A simple example showing execution of an HTTP request over a secure connection tunneled through an authenticating proxy.
This example shows how to stream out a request entity using chunk encoding.
This example demonstrates the use of a local HTTP context populated custom attributes.
This example demonstrates how HttpClient can be used to perform form-based logon.
An example that executes HTTP requests from multiple worker threads.
This example demonstrates how to create secure connections with a custom SSL context.
This example shows the use of protocol interceptors to transparently modify properties of HTTP messages sent / received by the HTTP client.
In this particular case HTTP client is made capable of transparent content GZIP compression by adding two protocol interceptors: a request interceptor that adds 'Accept-Encoding: gzip' header to all outgoing requests and a response interceptor that automatically expands compressed response entities by wrapping them with a uncompressing decorator class. The use of protocol interceptors makes content compression completely transparent to the consumer of the HttpClient interface.
This example shows how HttpClient can be customized to authenticate preemptively using BASIC scheme. Generally, preemptive authentication can be considered less secure than a response to an authentication challenge and therefore discouraged.
This example shows how HttpClient can be customized to authenticate preemptively using DIGEST scheme. Generally, preemptive authentication can be considered less secure than a response to an authentication challenge and therefore discouraged.
This example shows how to execute requests enclosing a multipart encoded entity.