Apache HttpComponents
Apache HttpComponents is a set of Java HTTP components, including a feature-rich HTTP client (HttpClient 5.x) and HTTP server components. It provides connection pooling, async I/O, TLS/SSL support, authentication, cookie management, and content negotiation for Java applications making HTTP requests.
APIs
Apache HttpComponents Client API
Java HTTP client library API for executing HTTP requests with connection pooling, async I/O, TLS/SSL, authentication, cookie management, and proxy support via Apache HttpCompone...
Apache HttpComponents Java SDK
Maven artifact for Apache HttpComponents HttpClient 5.x providing full HTTP client functionality including fluent API, async client, and reactive streams support.
Capabilities
Features
Configurable connection pool with per-route and total connection limits for efficient HTTP connection reuse.
Non-blocking async HTTP client based on Java NIO for high-concurrency request execution.
Full TLS/SSL support with customizable trust stores, client certificates, and hostname verification.
Pluggable authentication framework supporting Basic, Digest, NTLM, and Bearer token schemes.
RFC-compliant cookie management with customizable cookie stores and policies.
HTTP, HTTPS, and SOCKS proxy support with proxy authentication.
Built-in content encoding, compression (gzip/deflate), and charset negotiation.
High-level fluent API for simplified one-liner HTTP request execution.
Use Cases
Consume REST APIs from Java applications with connection pooling and retry logic.
Crawl and fetch web content with cookie handling and redirect following.
Make service-to-service HTTP calls with connection reuse and timeout configuration.
Implement OAuth2 token refresh flows using the authentication interceptor framework.
Stream large file uploads and downloads via multipart or chunked transfer encoding.
Integrations
Spring RestTemplate and WebClient use Apache HttpComponents as a configurable HTTP backend.
Apache CXF JAX-RS client uses HttpComponents for HTTP transport in web service calls.
Elasticsearch Java client uses HttpComponents for transport-layer HTTP communication.
Apache Solr Java client (SolrJ) uses HttpComponents for Solr HTTP API calls.