Class Http3ClientExamples
java.lang.Object
net.jrodolfo.java_evolution.java26.Http3ClientExamples
Demonstrates Java 26 HTTP/3 support in the HTTP Client API.
Java 11 standardized the HTTP Client API. Java 26 extends that client with HTTP/3 support, letting applications request the newer protocol through the same client model instead of switching to a separate networking library.
This example deliberately does not send a live HTTP/3 request. Real protocol negotiation depends on the target server, TLS configuration, QUIC/UDP reachability, proxies, firewalls, and network policy. The deterministic teaching point is the Java 26 API shape: applications can opt in to HTTP/3 at the client level or request level, and can provide an HTTP/3 discovery hint.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionBuilds one HTTP/3 request with an explicit discovery hint.Shows the default preferred protocol version for a standard client.Lists the HTTP/3 discovery modes understood by the JDK HTTP Client.Explains the executable boundary for this repository example.Returns the standard HTTP/3 discovery option added with Java 26.Builds an HTTP client whose preferred protocol version is HTTP/3.Builds one request whose preferred protocol version is HTTP/3.problem()Explains the problem addressed by HTTP/3 support.Describes the protocol relationship.Lists the protocol versions exposed by the Java 26 HTTP Client API.
-
Constructor Details
-
Http3ClientExamples
public Http3ClientExamples()
-
-
Method Details
-
problem
Explains the problem addressed by HTTP/3 support.- Returns:
- a short problem statement
-
defaultClientVersion
Shows the default preferred protocol version for a standard client.- Returns:
- the default preferred protocol version
-
http3PreferredClientVersion
Builds an HTTP client whose preferred protocol version is HTTP/3.- Returns:
- the preferred protocol version configured on the client
-
http3PreferredRequestVersion
Builds one request whose preferred protocol version is HTTP/3.- Parameters:
uri- target URI used only to construct the request- Returns:
- the preferred protocol version configured on the request
-
supportedVersionConstants
Lists the protocol versions exposed by the Java 26 HTTP Client API.- Returns:
- fixed-size list of protocol versions
-
http3DiscoveryOption
Returns the standard HTTP/3 discovery option added with Java 26.- Returns:
- the HTTP/3 discovery option
-
configuredDiscoveryMode
public HttpOption.Http3DiscoveryMode configuredDiscoveryMode(URI uri, HttpOption.Http3DiscoveryMode mode) Builds one HTTP/3 request with an explicit discovery hint.- Parameters:
uri- target URI used only to construct the requestmode- HTTP/3 discovery mode to attach to the request- Returns:
- the HTTP/3 discovery mode configured on the request
-
discoveryModes
Lists the HTTP/3 discovery modes understood by the JDK HTTP Client.- Returns:
- fixed-size list of HTTP/3 discovery modes
-
protocolContext
Describes the protocol relationship.- Returns:
- a short protocol explanation
-
executableBoundary
Explains the executable boundary for this repository example.- Returns:
- the executable boundary
-