Interface HttpOption<T>
- Type Parameters:
T- The type of the option value
public sealed interface HttpOption<T>
HttpClient implementation. Request configuration option hints can be provided to an HttpRequest with the HttpRequest.Builder
setOption method. Concrete instances of this class and its subclasses are immutable.
- API Note:
- In this version, the
HttpOptioninterface is sealed and only allows theH3_DISCOVERYoption. However, it could be extended in the future to support additional options.The
H3_DISCOVERYoption can be used to help theHttpClientdecide how to select or establish an HTTP/3 connection through which to carry out an HTTP/3 request/response exchange. - Since:
- 26
Nested Class Summary
| Modifier and Type | Interface | Description |
|---|---|---|
static enum |
HttpOption.Http3DiscoveryMode |
This enumeration can be used to help the HttpClient decide how an HTTP/3 exchange should be established, and can be provided as the value of the H3_DISCOVERY option to Builder.setOption. |
Field Summary
| Modifier and Type | Field | Description |
|---|---|---|
static final HttpOption |
H3_DISCOVERY |
An option that can be used to configure how the HttpClient will select or establish an HTTP/3 connection through which to carry out the request. |
Method Summary
Field Details
H3_DISCOVERY
static final HttpOption<HttpOption.Http3DiscoveryMode> H3_DISCOVERY
HttpClient will select or establish an HTTP/3 connection through which to carry out the request. If HttpClient.Version.HTTP_3 is not selected either as the request preferred version or the HttpClient preferred version setting this option on the request has no effect. The name of this option is "H3_DISCOVERY".
- Implementation Note:
- The JDK built-in implementation of the
HttpClientunderstands the request optionH3_DISCOVERYhint.
If noH3_DISCOVERYhint is provided, and the HTTP/3 version is selected, either as request preferred version or client preferred version, the JDK built-in implementation will establish the exchange as perHttpOption.Http3DiscoveryMode.ANY.In case of redirect, the
H3_DISCOVERYoption, if present, is always transferred to the new request.In this implementation, HTTP/3 through proxies is not supported. Unless
HttpOption.Http3DiscoveryMode.HTTP_3_URI_ONLYis specified, if a proxy is selected for the request URI, the protocol version is downgraded to HTTP/2 or HTTP/1.1 and theH3_DISCOVERYoption is ignored. If, on the other hand,HttpOption.Http3DiscoveryMode.HTTP_3_URI_ONLYis specified, the request will fail. - See Also:
Method Details
name
String name()
- Implementation Requirements:
- Different options must have different names.
- Returns:
- the option name
type
Class<T> type()
- API Note:
- Different options may have the same type.
- Returns:
- the type of the value associated with the option
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.