Class Http3ClientExamples

java.lang.Object
net.jrodolfo.java_evolution.java26.Http3ClientExamples

public class Http3ClientExamples extends Object
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 Details

    • Http3ClientExamples

      public Http3ClientExamples()
  • Method Details

    • problem

      public String problem()
      Explains the problem addressed by HTTP/3 support.
      Returns:
      a short problem statement
    • defaultClientVersion

      public HttpClient.Version defaultClientVersion()
      Shows the default preferred protocol version for a standard client.
      Returns:
      the default preferred protocol version
    • http3PreferredClientVersion

      public HttpClient.Version http3PreferredClientVersion()
      Builds an HTTP client whose preferred protocol version is HTTP/3.
      Returns:
      the preferred protocol version configured on the client
    • http3PreferredRequestVersion

      public HttpClient.Version http3PreferredRequestVersion(URI uri)
      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

      public List<HttpClient.Version> supportedVersionConstants()
      Lists the protocol versions exposed by the Java 26 HTTP Client API.
      Returns:
      fixed-size list of protocol versions
    • http3DiscoveryOption

      public HttpOption<HttpOption.Http3DiscoveryMode> 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 request
      mode - HTTP/3 discovery mode to attach to the request
      Returns:
      the HTTP/3 discovery mode configured on the request
    • discoveryModes

      public List<HttpOption.Http3DiscoveryMode> discoveryModes()
      Lists the HTTP/3 discovery modes understood by the JDK HTTP Client.
      Returns:
      fixed-size list of HTTP/3 discovery modes
    • protocolContext

      public String protocolContext()
      Describes the protocol relationship.
      Returns:
      a short protocol explanation
    • executableBoundary

      public String executableBoundary()
      Explains the executable boundary for this repository example.
      Returns:
      the executable boundary