public interface HttpClient extends Measured
An HTTP client that maintains a pool of connections to a specific host, at a specific port. The client supports
pipelining of requests.<p>
As well as HTTP requests, the client can act as a factory for WebSocket websockets
.<p>
If an instance is instantiated from an event loop then the handlers
of the instance will always be called on that same event loop.
If an instance is instantiated from some other arbitrary Java thread (i.e. when running embedded) then
and event loop will be assigned to the instance and used when any of its handlers
are called.<p>
Instances of HttpClient are thread-safe.<p>
metricBaseName, metrics
HttpClientRequest request(HttpMethod method, String absoluteURI)
HttpClientRequest request(HttpMethod method, int port, String host, String requestURI)
Create a new http client request.
The returned request does not have yet a response handler and one should be set before sending any data to the remote server.
method
- the http methodport
- the remote server porthost
- the remote server hostrequestURI
- the request uriHttpClientRequest request(HttpMethod method, String absoluteURI, Handler<HttpClientResponse> responseHandler)
HttpClientRequest request(HttpMethod method, int port, String host, String requestURI, Handler<HttpClientResponse> responseHandler)
WebSocketStream websocket(int port, String host, String requestURI)
WebSocketStream websocket(int port, String host, String requestURI, MultiMap headers)
WebSocketStream websocket(int port, String host, String requestURI, MultiMap headers, WebsocketVersion version)
WebSocketStream websocket(int port, String host, String requestURI, MultiMap headers, WebsocketVersion version, String subProtocols)
WebSocketStream
configured with the specified argumentsHttpClient connectWebsocket(int port, String host, String requestURI, Handler<WebSocket> wsConnect)
HttpClient connectWebsocket(int port, String host, String requestURI, MultiMap headers, Handler<WebSocket> wsConnect)
HttpClient connectWebsocket(int port, String host, String requestURI, MultiMap headers, WebsocketVersion version, Handler<WebSocket> wsConnect)
HttpClient connectWebsocket(int port, String host, String requestURI, MultiMap headers, WebsocketVersion version, String subProtocols, Handler<WebSocket> wsConnect)
void close()
Close the HTTP client. This will cause any pooled HTTP connections to be closed.
Copyright © 2014. All Rights Reserved.