Class JavaHttpTransportProvider

java.lang.Object
org.apache.juneau.rest.client.JavaHttpTransportProvider
All Implemented Interfaces:
HttpTransportProvider

public final class JavaHttpTransportProvider extends Object implements HttpTransportProvider
HttpTransportProvider implementation that supplies a JavaHttpTransport.

Registered via META-INF/services/HttpTransportProvider so that RestClient auto-discovers the JDK HTTP client when no higher-priority transport is present. Since the JDK transport ships in the juneau-rest-client artifact itself, it is always available unless overridden by a sibling transport module with a lower priority value.

See Also:
Since:
9.2.1
  • Constructor Details

  • Method Details

    • getPriority

      public int getPriority()
      Description copied from interface: HttpTransportProvider
      Returns the priority of this provider.

      When multiple providers are available, the one with the lowest priority value is used first. This allows applications to install a high-priority mock or test transport that takes precedence over real transports.

      Specified by:
      getPriority in interface HttpTransportProvider
      Returns:
      The priority. Defaults to 100.
    • isAvailable

      public boolean isAvailable()
      Description copied from interface: HttpTransportProvider
      Returns true if the required runtime dependencies of this transport are present on the classpath.

      Providers must check for their dependencies here (e.g. by attempting to load the underlying client class) so that RestClient can safely skip providers whose jars are absent.

      Specified by:
      isAvailable in interface HttpTransportProvider
      Returns:
      true if available.
    • create

      Description copied from interface: HttpTransportProvider
      Creates and returns a new HttpTransport instance using default configuration.
      Specified by:
      create in interface HttpTransportProvider
      Returns:
      A new transport. Never null.