Class JavaNetHttpConnectorProvider

java.lang.Object
org.glassfish.jersey.jnh.connector.JavaNetHttpConnectorProvider
All Implemented Interfaces:
ConnectorProvider

public class JavaNetHttpConnectorProvider extends Object implements ConnectorProvider
A provider class for a Jersey client Connector using Java's HttpClient.

The following configuration properties are available:

Author:
Steffen Nießing
  • Constructor Details

    • JavaNetHttpConnectorProvider

      public JavaNetHttpConnectorProvider()
  • Method Details

    • getConnector

      public Connector getConnector(Client client, Configuration runtimeConfig)
      Description copied from interface: ConnectorProvider
      Get a Jersey client connector instance for a given client instance and Jersey client runtime configuration.

      Note that the supplied runtime configuration can be different from the client instance configuration as a single client can be used to serve multiple differently configured runtimes. While the SSL context or hostname verifier are shared, other configuration properties may change in each runtime.

      Based on the supplied client and runtime configuration data, it is up to each connector provider implementation to decide whether a new dedicated connector instance is required or if the existing, previously create connector instance can be reused.

      Specified by:
      getConnector in interface ConnectorProvider
      Parameters:
      client - Jersey client instance.
      runtimeConfig - Jersey client runtime configuration.
      Returns:
      configured Connector instance to be used by the client.
    • getHttpClient

      public static HttpClient getHttpClient(Configurable<?> component)
      Retrieve the Java HttpClient used by the provided JavaNetHttpConnector.
      Parameters:
      component - the component from which the JavaNetHttpConnector should be retrieved
      Returns:
      a Java HttpClient instance
      Throws:
      IllegalArgumentException - if a JavaNetHttpConnector cannot be provided from the given component