Provides high-level client interfaces to HTTP (versions 1.1, 2, and 3) and low-level client interfaces to WebSocket. The main types defined are:
java.net.http.HttpClient java.net.http.HttpRequest java.net.http.HttpResponse java.net.http.WebSocket The protocol-specific requirements are defined in the Hypertext Transfer Protocol Version 3 (HTTP/3), the Hypertext Transfer Protocol Version 2 (HTTP/2), the Hypertext Transfer Protocol (HTTP/1.1), and The WebSocket Protocol.
In general, asynchronous tasks execute in either the thread invoking
the operation, e.g. sending an HTTP request, or by the threads supplied by the client's executor. Dependent tasks, those that are triggered by
returned CompletionStages or CompletableFutures, that do not explicitly
specify an executor, execute in the same default executor as that of CompletableFuture, or the invoking thread if the operation completes before
the dependent task is registered.
CompletableFutures returned by this API will throw UnsupportedOperationException for their obtrudeValue
and obtrudeException methods. Unless otherwise specified, invoking
the cancel method on a
CompletableFuture returned by this API may 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.
java.net.http/
| Modifier and Type | Interface and Description |
|---|---|
| public interface | HttpOption<T>
This interface is used to provide additional request configuration
option hints on how an HTTP request/response exchange should
be carried out by the |
| public interface | |
| public interface | WebSocket
A WebSocket Client. |
| Modifier and Type | Class and Description |
|---|---|
| public abstract class | HttpClient
An HTTP Client. |
| public class | HttpConnectTimeoutException
Thrown when a connection, over which an |
| public class | HttpHeaders
A read-only view of a set of HTTP headers. |
| public abstract class | HttpRequest
An HTTP request. |
| public class | HttpTimeoutException
Thrown when a response is not received within a specified time period. |
| public class | StreamLimitException
An exception raised when the limit imposed for stream creation on an HTTP connection is reached, and the client is unable to create a new stream. |
| public class | UnsupportedProtocolVersionException
Thrown when the HTTP client doesn't support a particular HTTP version. |
| public class | WebSocketHandshakeException
Thrown when the opening handshake has failed. |