Package jdk.incubator.http
High level HTTP and WebSocket API
Incubating Feature. Will be removed in a future release.
Provides high-level client interfaces to HTTP (versions 1.1 and 2) and WebSocket. The main types defined are:
The API functions asynchronously (using CompletableFuture
)
and work is done on the threads supplied by the client's Executor
where practical.
HttpClient
also provides a simple synchronous mode, where all
work may be done on the calling thread.
CompletableFuture
s returned by this API will throw UnsupportedOperationException
for their obtrudeValue
and obtrudeException
methods. Invoking the cancel
method on a CompletableFuture
returned by this API will not interrupt
the underlying operation, but may be useful to complete, exceptionally,
dependent stages that have not already completed.
Unless otherwise stated, null
parameter values will cause methods
of all classes in this package to throw NullPointerException
.
- Since:
- 9
-
Interface Summary Interface Description HttpRequest.BodyPublisher A Publisher which converts high level Java objects into flows of byte buffers suitable for sending as request bodies.HttpResponse.BodyHandler<T> A handler for response bodies.HttpResponse.BodySubscriber<T> A subscriber for response bodies.HttpResponse.MultiSubscriber<U,T> A response subscriber for a HTTP/2 multi response.WebSocket A WebSocket client.WebSocket.Builder A builder for creatingWebSocket
instances.WebSocket.Listener The receiving interface ofWebSocket
. -
Class Summary Class Description HttpClient A container for configuration information common to multipleHttpRequest
s.HttpClient.Builder A builder of immutableHttpClient
s.HttpHeaders A read-only view of a set of HTTP headers.HttpRequest Represents one HTTP request which can be sent to a server.HttpRequest.Builder A builder of HTTP Requests.HttpResponse<T> Represents a response to aHttpRequest
.MultiMapResult<V> AMap
containing the result of a HTTP/2 request and multi-response. -
Enum Summary Enum Description HttpClient.Redirect Defines automatic redirection policy.HttpClient.Version The HTTP protocol version.WebSocket.MessagePart A marker used byWebSocket.Listener
for identifying partial messages. -
Exception Summary Exception Description HttpTimeoutException Thrown when a response is not received within a specified time period.WebSocketHandshakeException An exception used to signal the opening handshake failed.