public interface HttpClientTransport
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 a 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 SPDY protocol or the FCGI protocol or, in future,
other protocols.Modifier and Type | Method and Description |
---|---|
void |
connect(HttpDestination destination,
SocketAddress address,
Promise<Connection> promise)
Establishes a physical connection to the given
address . |
HttpDestination |
newHttpDestination(String scheme,
String host,
int port)
Creates a new, transport-specific,
HttpDestination object. |
void |
setHttpClient(HttpClient client)
Sets the
HttpClient instance on this transport. |
Connection |
tunnel(Connection connection)
Establishes an encrypted tunnel over the given
connection |
void setHttpClient(HttpClient client)
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
.client
- the HttpClient
that uses this transport.HttpDestination newHttpDestination(String scheme, String host, int port)
HttpDestination
object.
HttpDestination
controls the destination-connection cardinality: protocols like
HTTP have 1-N cardinality, while multiplexed protocols like SPDY have a 1-1 cardinality.scheme
- the destination schemehost
- the destination hostport
- the destination portHttpDestination
objectvoid connect(HttpDestination destination, SocketAddress address, Promise<Connection> promise)
address
.destination
- the destinationaddress
- the address to connect topromise
- the promise to notify when the connection succeeds or failsConnection tunnel(Connection connection)
connection
connection
- the connection to tunnelCopyright © 1995-2013 Mort Bay Consulting. All Rights Reserved.