Package org.apache.juneau.rest.client
Class JavaHttpTransportProvider
java.lang.Object
org.apache.juneau.rest.client.JavaHttpTransportProvider
- All Implemented Interfaces:
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreate()Creates and returns a newHttpTransportinstance using default configuration.intReturns the priority of this provider.booleanReturnstrueif the required runtime dependencies of this transport are present on the classpath.
-
Constructor Details
-
JavaHttpTransportProvider
public JavaHttpTransportProvider()
-
-
Method Details
-
getPriority
Description copied from interface:HttpTransportProviderReturns 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:
getPriorityin interfaceHttpTransportProvider- Returns:
- The priority. Defaults to
100.
-
isAvailable
Description copied from interface:HttpTransportProviderReturnstrueif 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
RestClientcan safely skip providers whose jars are absent.- Specified by:
isAvailablein interfaceHttpTransportProvider- Returns:
trueif available.
-
create
Description copied from interface:HttpTransportProviderCreates and returns a newHttpTransportinstance using default configuration.- Specified by:
createin interfaceHttpTransportProvider- Returns:
- A new transport. Never
null .
-