Class OkHttpTransportProvider
java.lang.Object
org.apache.juneau.rest.client.okhttp.OkHttpTransportProvider
- All Implemented Interfaces:
HttpTransportProvider
HttpTransportProvider implementation that supplies an OkHttpTransport.
Registered via META-INF/services/HttpTransportProvider so that
RestClient can auto-discover OkHttp 5.x when this module is on the classpath.
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
-
OkHttpTransportProvider
public OkHttpTransportProvider()
-
-
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 .
-