HttpClient Overview
The Hyper-Text Transfer Protocol (HTTP) is perhaps the most significant protocol used on the Internet today. Web services, network-enabled appliances and the growth of network computing continue to expand the role of the HTTP protocol beyond user-driven web browsers, while increasing the number of applications that require HTTP support.
Although the java.net package provides basic functionality for accessing resources via HTTP, it doesn't provide the full flexibility or functionality needed by many applications. HttpClient seeks to fill this void by providing an efficient, up-to-date, and feature-rich package implementing the client side of the most recent HTTP standards and recommendations.
Designed for extension while providing robust support for the base HTTP protocol, HttpClient may be of interest to anyone building HTTP-aware client applications such as web browsers, web service clients, or systems that leverage or extend the HTTP protocol for distributed communication.
Documentation
-
Quick Start - contains simple, complete examples of request execution with the classic, fluent and async APIs.
-
Architecture - describes HttpClient architecture pronciples such as the layering concept.
-
Guides
- Migration - helps choose the best migration path from older version of Apache HttpClient, different i/o models supported by Apache HttpClient or other HTTP clients.
- Configuration - describes principles of HttpClient configuration.
- Logging
- Connection management
- Connection pooling
- Async content compression / decompression
- Android support
- Early Hints
- Observation
- SCRAM-SHA-256
- SPKI pinning TLS strategy
-
Examples demonstrating some common as well as more complex use cases
-
Javadocs
-
API compatibility reports
Features
- Standards based, pure Java, implementation of HTTP versions 1.0, 1.1, 2.0
- Supports encryption with HTTPS (HTTP over SSL) protocol.
- Pluggable TLS strategies.
- Transparent message exchanges through HTTP/1.1, HTTP/1.0 and SOCKS proxies.
- Tunneled HTTPS connections through HTTP/1.1 and HTTP/1.0 proxies, via the CONNECT method.
- Basic, Digest, Bearer, SCRAM-SHA-256 authentication schemes.
- HTTP state management and cookie support.
- Flexible connection management and pooling with STRICT, LAX and OFFLOCK concurrency policies.
- Optional off-lock disposal for blocking connection pools to move slow graceful closes off hot pool locks.
- Basic, Digest, Bearer, and SCRAM-SHA-256 authentication schemes.
- Support for HTTP response caching. Pluggable storage backends based on Ehcache, Memcached, Caffeine.
- Transparent content decompression with deflate, gzip, and optional zstd / brotli codecs.
- Support for Unix domain sockets.
- Experimental RFC 9218 prioritization (Priority header & PRIORITY_UPDATE for HTTP/2).
- I/O byte counters, connection-pool gauges, and DNS/TLS meters for classic and async clients.
- Optional SPKI pinning TLS strategy for host / wildcard public-key pinning.
- Async support for 103 Early Hints via a pluggable
- Optional Observability nodule with Micrometer / OpenTelemetry support for request timers/counters,
- Optional Server-Sent Events (SSE) module for consuming long-lived event streams over HTTP/1.1 and HTTP/2 using the async transport.
- Source code is freely available under the Apache License.
Standards Compliance
HttpClient strives to conform to the following specifications endorsed by the Internet Engineering Task Force (IETF) and the internet at large:
- RFC 9110 - HTTP Semantics
- RFC 9111 - HTTP Caching
- RFC 9112 - Hypertext Transfer Protocol Version 1.1 (HTTP/1.1)
- RFC 7540 - Hypertext Transfer Protocol Version 2 (HTTP/2)
- RFC 7541 - HPACK: Header Compression for HTTP/2
- RFC 1945 - Hypertext Transfer Protocol – HTTP/1.0
- RFC 2396 - Uniform Resource Identifiers (URI): Generic Syntax
- RFC 6265 - HTTP State Management Mechanism (Cookies)
- RFC 7616 - HTTP Digest Access Authentication
- RFC 7617 - HTTP ‘Basic’ Authentication Scheme
- RFC 5861 - HTTP Cache-Control Extensions for Stale Content
- RFC 2817 - Upgrading to TLS Within HTTP/1.1
- RFC 9218 - Extensible Prioritization Scheme for HTTP
- RFC 7804 - Salted Challenge Response HTTP Authentication Mechanism
- RFC 8297 – Early Hints status code




