It allows you to make requests to HTTP servers, and a single client can make requests to any server.
This gives the benefits of keep alive when the client is loaded but means we don't keep connections hanging around unnecessarily when there would be no benefits anyway.
The client is designed to be reused between requests.
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public Future | |
| public HttpClient | Returns: a reference to this, so the API can be used fluently
Deprecated
instead use
HttpClientBuilder#withConnectHandler(Handler)
Set a connection handler for the client. |
| public HttpClient | Returns: a reference to this, so the API can be used fluentlythe new redirect handler handler)
Deprecated
instead use
HttpClientBuilder#withRedirectHandler(Function)
Set a redirect handler for the http client. |
| public Function | |
| public void | request(RequestOptions
the request options options, Handler<AsyncResult<HttpClientRequest>> the handler called when the request is ready to be sent handler)Create an HTTP request to send to the server. |
| public Future | request(RequestOptions options)
Like |
| public void | request(HttpMethod
the HTTP method method, int the port port, String the host host, String the relative URI requestURI, Handler<AsyncResult<HttpClientRequest>> the handler called when the request is ready to be sent handler)Create an HTTP request to send to the server at the |
| public default Future | request(HttpMethod method, int port, String host, String requestURI)
Like |
| public void | request(HttpMethod
the HTTP method method, String the host host, String the relative URI requestURI, Handler<AsyncResult<HttpClientRequest>> the handler called when the request is ready to be sent handler)Create an HTTP request to send to the server at the |
| public default Future | request(HttpMethod method, String host, String requestURI)
Like |
| public void | request(HttpMethod
the HTTP method method, String the relative URI requestURI, Handler<AsyncResult<HttpClientRequest>> the handler called when the request is ready to be sent handler)Create an HTTP request to send to the server at the default host and port. |
| public default Future | request(HttpMethod method, String requestURI)
Like |
| public default Future | Returns: a future signaling the update successthe new SSL options options)Update the client with new SSL |
| public default void | updateSSLOptions(SSLOptions
the new SSL options options, Handler<AsyncResult<Boolean>> the update handler handler)Like |
| public Future | Returns: a future signaling the update successthe new SSL options options, boolean force the update when options are equals force)Update the client with new SSL |
| public default void | updateSSLOptions(SSLOptions
the new SSL options options, boolean force the update when options are equals force, Handler<AsyncResult<Boolean>> the update handler handler)Like |
| public void | webSocket(int
the port port, String the host host, String the relative URI requestURI, Handler<AsyncResult<WebSocket>> handler that will be called with the WebSocket when connected handler)
Deprecated
instead use
WebSocketClient#connect(int, String, String, Handler)
Connect a WebSocket to the specified port, host and relative request URI |
| public Future | webSocket(int port, String host, String requestURI)
Deprecated
instead use
WebSocketClient#connect(int, String, String)
Like |
| public void | webSocket(String
the host host, String the relative URI requestURI, Handler<AsyncResult<WebSocket>> handler that will be called with the WebSocket when connected handler)
Deprecated
instead use
WebSocketClient#connect(int, String, String, Handler)
Connect a WebSocket to the host and relative request URI and default port |
| public Future | webSocket(String host, String requestURI)
Deprecated
instead use
WebSocketClient#connect(int, String, String)
Like |
| public void | webSocket(String
the relative URI requestURI, Handler<AsyncResult<WebSocket>> handler that will be called with the WebSocket when connected handler)
Deprecated
instead use
WebSocketClient#connect(int, String, String, Handler)
Connect a WebSocket at the relative request URI using the default host and port |
| public Future | webSocket(String requestURI)
Deprecated
instead use
WebSocketClient#connect(int, String, String)
Like |
| public void | webSocket(WebSocketConnectOptions
the request options options, Handler<AsyncResult<WebSocket>> handler)
Deprecated
instead use
WebSocketClient#connect(WebSocketConnectOptions, Handler)
Connect a WebSocket with the specified options. |
| public Future | webSocket(WebSocketConnectOptions options)
Deprecated
instead use
WebSocketClient#connect(WebSocketConnectOptions)
Like |
| public void | webSocketAbs(String
the absolute url url, MultiMap the headers headers, WebsocketVersion the WebSocket version version, List<String> the subprotocols to use subProtocols, Handler<AsyncResult<WebSocket>> handler that will be called if WebSocket connection fails handler)
Deprecated
instead use
WebSocketClient#connect(WebSocketConnectOptions, Handler)
Connect a WebSocket with the specified absolute url, with the specified headers, using the specified version of WebSockets, and the specified WebSocket sub protocols. |
| public Future | webSocketAbs(String url, MultiMap headers, WebsocketVersion version, List<String> subProtocols)
Deprecated
instead use
WebSocketClient#connect(WebSocketConnectOptions)
Like |
| close | back to summary |
|---|---|
| public void close(Handler<AsyncResult<Void>> handler) Close the client. Closing will close down any pooled connections. Clients should always be closed after use. | |
| close | back to summary |
|---|---|
| public Future Like | |
| connectionHandler | back to summary |
|---|---|
| public HttpClient connectionHandler(Handler<HttpConnection> handler)
Deprecated instead use Set a connection handler for the client. This handler is called when a new connection is established.
| |
| redirectHandler | back to summary |
|---|---|
| public HttpClient redirectHandler(Function<HttpClientResponse, Future<RequestOptions>> handler)
Deprecated instead use Set a redirect handler for the http client.
The redirect handler is called when a
The redirect handler is passed the
The handler must return a
| |
| redirectHandler | back to summary |
|---|---|
| public Function Deprecated
| |
| request | back to summary |
|---|---|
| public void request(RequestOptions options, Handler<AsyncResult<HttpClientRequest>> handler) Create an HTTP request to send to the server. The
| |
| request | back to summary |
|---|---|
| public Future Like | |
| request | back to summary |
|---|---|
| public void request(HttpMethod method, int port, String host, String requestURI, Handler<AsyncResult<HttpClientRequest>> handler) Create an HTTP request to send to the server at the
| |
| request | back to summary |
|---|---|
| public default Future Like | |
| request | back to summary |
|---|---|
| public void request(HttpMethod method, String host, String requestURI, Handler<AsyncResult<HttpClientRequest>> handler) Create an HTTP request to send to the server at the
| |
| request | back to summary |
|---|---|
| public default Future Like | |
| request | back to summary |
|---|---|
| public void request(HttpMethod method, String requestURI, Handler<AsyncResult<HttpClientRequest>> handler) Create an HTTP request to send to the server at the default host and port. The
| |
| request | back to summary |
|---|---|
| public default Future Like | |
| updateSSLOptions | back to summary |
|---|---|
| public default Future Update the client with new SSL The boolean succeeded future result indicates whether the update occurred.
| |
| updateSSLOptions | back to summary |
|---|---|
| public default void updateSSLOptions(SSLOptions options, Handler<AsyncResult<Boolean>> handler) Like
| |
| updateSSLOptions | back to summary |
|---|---|
| public Future Update the client with new SSL The The boolean succeeded future result indicates whether the update occurred.
| |
| updateSSLOptions | back to summary |
|---|---|
| public default void updateSSLOptions(SSLOptions options, boolean force, Handler<AsyncResult<Boolean>> handler) Like
| |
| webSocket | back to summary |
|---|---|
| public void webSocket(int port, String host, String requestURI, Handler<AsyncResult<WebSocket>> handler)
Deprecated instead use Connect a WebSocket to the specified port, host and relative request URI
| |
| webSocket | back to summary |
|---|---|
| public Future Deprecated instead use Like
| |
| webSocket | back to summary |
|---|---|
| public void webSocket(String host, String requestURI, Handler<AsyncResult<WebSocket>> handler)
Deprecated instead use Connect a WebSocket to the host and relative request URI and default port
| |
| webSocket | back to summary |
|---|---|
| public Future Deprecated instead use Like
| |
| webSocket | back to summary |
|---|---|
| public void webSocket(String requestURI, Handler<AsyncResult<WebSocket>> handler)
Deprecated instead use Connect a WebSocket at the relative request URI using the default host and port
| |
| webSocket | back to summary |
|---|---|
| public Future Deprecated instead use Like
| |
| webSocket | back to summary |
|---|---|
| public void webSocket(WebSocketConnectOptions options, Handler<AsyncResult<WebSocket>> handler)
Deprecated instead use Connect a WebSocket with the specified options.
| |
| webSocket | back to summary |
|---|---|
| public Future Deprecated instead use Like
| |
| webSocketAbs | back to summary |
|---|---|
| public void webSocketAbs(String url, MultiMap headers, WebsocketVersion version, List<String> subProtocols, Handler<AsyncResult<WebSocket>> handler)
Deprecated instead use Connect a WebSocket with the specified absolute url, with the specified headers, using the specified version of WebSockets, and the specified WebSocket sub protocols.
| |
| webSocketAbs | back to summary |
|---|---|
| public Future Deprecated instead use Like
| |