Interface HttpClientTransport

All Superinterfaces:
ClientConnectionFactory
All Known Implementing Classes:
AbstractConnectorHttpClientTransport, AbstractHttpClientTransport, HttpClientTransportDynamic, HttpClientTransportOverFCGI, HttpClientTransportOverHTTP, HttpClientTransportOverHTTP2, HttpClientTransportOverHTTP3, HttpClientTransportOverUnixSockets

public interface HttpClientTransport extends ClientConnectionFactory
HttpClientTransport represents what transport implementations should provide in order to plug-in a different transport for HttpClient.

While the HttpClient APIs define the HTTP semantic (request, response, headers, etc.) how an HTTP exchange is carried over the network depends on implementations of this class.

The default implementation uses the HTTP protocol to carry over the network the HTTP exchange, but the HTTP exchange may also be carried using the FCGI protocol, the HTTP/2 protocol or, in future, other protocols.

  • Field Details

  • Method Details

    • setHttpClient

      void setHttpClient(HttpClient client)
      Sets the HttpClient instance on this transport.

      This is needed because of a chicken-egg problem: in order to create the HttpClient a HttpClientTransport is needed, that therefore cannot have a reference yet to the HttpClient.

      Parameters:
      client - the HttpClient that uses this transport.
    • newOrigin

      Origin newOrigin(HttpRequest request)
      Creates a new Origin with the given request.
      Parameters:
      request - the request that triggers the creation of the Origin
      Returns:
      an Origin that identifies a destination
    • newHttpDestination

      HttpDestination newHttpDestination(Origin origin)
      Creates a new, transport-specific, HttpDestination object.

      HttpDestination controls the destination-connection cardinality: protocols like HTTP have 1-N cardinality, while multiplexed protocols like HTTP/2 have a 1-1 cardinality.

      Parameters:
      origin - the destination origin
      Returns:
      a new, transport-specific, HttpDestination object
    • connect

      @Deprecated void connect(InetSocketAddress address, Map<String,Object> context)
      Deprecated.
      Establishes a physical connection to the given address.
      Parameters:
      address - the address to connect to
      context - the context information to establish the connection
    • connect

      default void connect(SocketAddress address, Map<String,Object> context)
      Establishes a physical connection to the given address.
      Parameters:
      address - the address to connect to
      context - the context information to establish the connection
    • getConnectionPoolFactory

      ConnectionPool.Factory getConnectionPoolFactory()
      Returns:
      the factory for ConnectionPool instances
    • setConnectionPoolFactory

      void setConnectionPoolFactory(ConnectionPool.Factory factory)
      Parameters:
      factory - the factory for ConnectionPool instances