Class JavaNetHttpConnector

java.lang.Object
org.glassfish.jersey.jnh.connector.JavaNetHttpConnector
All Implemented Interfaces:
Connector, Inflector<ClientRequest,ClientResponse>

public class JavaNetHttpConnector extends Object implements Connector
Provides a Jersey client Connector, which internally uses Java's HttpClient. The following properties are provided to Java's HttpClient.Builder during creation of the HttpClient:
Author:
Steffen Nießing
  • Constructor Details

    • JavaNetHttpConnector

      public JavaNetHttpConnector(Client client, Configuration configuration)
      Constructs a new Connector for a Jersey client instance using Java's HttpClient.
      Parameters:
      client - a Jersey client instance to get additional configuration properties from (e.g. SSLContext)
      configuration - the configuration properties for this connector
  • Method Details

    • getHttpClient

      public HttpClient getHttpClient()
      Returns the underlying HttpClient instance used by this connector.
      Returns:
      the Java HttpClient instance
    • apply

      public ClientResponse apply(ClientRequest request)
      Description copied from interface: Connector
      Synchronously process client request into a response. The method is used by Jersey client runtime to synchronously send a request and receive a response.
      Specified by:
      apply in interface Connector
      Specified by:
      apply in interface Inflector<ClientRequest,ClientResponse>
      Parameters:
      request - Jersey client request to be sent.
      Returns:
      Jersey client response received for the client request.
    • apply

      public Future<?> apply(ClientRequest request, AsyncConnectorCallback callback)
      Description copied from interface: Connector
      Asynchronously process client request into a response. The method is used by Jersey client runtime to asynchronously send a request and receive a response.
      Specified by:
      apply in interface Connector
      Parameters:
      request - Jersey client request to be sent.
      callback - Jersey asynchronous connector callback to asynchronously receive the request processing result (either a response or a failure).
      Returns:
      asynchronously executed task handle.
    • getName

      public String getName()
      Description copied from interface: Connector
      Get name of current connector. Should contain identification of underlying specification and optionally version number. Will be used in User-Agent header.
      Specified by:
      getName in interface Connector
      Returns:
      name of current connector. Returning null or empty string means not including this information in a generated "User-Agent" header.
    • close

      public void close()
      Description copied from interface: Connector
      Close connector and release all it's internally associated resources.
      Specified by:
      close in interface Connector
    • getCookieHandler

      public CookieHandler getCookieHandler()