public class HttpClient extends Object implements Measured
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.
NOTE: This class has been automatically generated from theoriginal
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<HttpClient> |
__TYPE_ARG |
Constructor and Description |
---|
HttpClient(HttpClient delegate) |
HttpClient(Object delegate) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the client.
|
void |
close(Handler<AsyncResult<Void>> handler)
Close the client.
|
HttpClient |
connectionHandler(Handler<HttpConnection> handler)
Deprecated.
|
boolean |
equals(Object o) |
HttpClient |
getDelegate() |
int |
hashCode() |
boolean |
isMetricsEnabled()
Whether the metrics are enabled for this measured object
|
static HttpClient |
newInstance(HttpClient arg) |
HttpClient |
redirectHandler(java.util.function.Function<HttpClientResponse,Future<RequestOptions>> handler)
Deprecated.
|
HttpClient |
redirectHandler(Function<HttpClientResponse,Single<RequestOptions>> handler)
Deprecated.
|
void |
request(HttpMethod method,
int port,
String host,
String requestURI)
Create an HTTP request to send to the server at the
host and port . |
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
host and port . |
void |
request(HttpMethod method,
String requestURI)
Create an HTTP request to send to the server at the default host and port.
|
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.
|
void |
request(HttpMethod method,
String host,
String requestURI)
Create an HTTP request to send to the server at the
host and default port. |
void |
request(HttpMethod method,
String host,
String requestURI,
Handler<AsyncResult<HttpClientRequest>> handler)
Create an HTTP request to send to the server at the
host and default port. |
void |
request(RequestOptions options)
Create an HTTP request to send to the server.
|
void |
request(RequestOptions options,
Handler<AsyncResult<HttpClientRequest>> handler)
Create an HTTP request to send to the server.
|
Completable |
rxClose()
Close the client.
|
Single<HttpClientRequest> |
rxRequest(HttpMethod method,
int port,
String host,
String requestURI)
Create an HTTP request to send to the server at the
host and port . |
Single<HttpClientRequest> |
rxRequest(HttpMethod method,
String requestURI)
Create an HTTP request to send to the server at the default host and port.
|
Single<HttpClientRequest> |
rxRequest(HttpMethod method,
String host,
String requestURI)
Create an HTTP request to send to the server at the
host and default port. |
Single<HttpClientRequest> |
rxRequest(RequestOptions options)
Create an HTTP request to send to the server.
|
Single<Boolean> |
rxUpdateSSLOptions(SSLOptions options)
Like
updateSSLOptions(io.vertx.core.net.SSLOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>>) but supplying a handler that will be called when the update
happened (or has failed). |
Single<Boolean> |
rxUpdateSSLOptions(SSLOptions options,
boolean force)
Like
updateSSLOptions(io.vertx.core.net.SSLOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>>) but supplying a handler that will be called when the update
happened (or has failed). |
Single<WebSocket> |
rxWebSocket(int port,
String host,
String requestURI)
Deprecated.
|
Single<WebSocket> |
rxWebSocket(String requestURI)
Deprecated.
|
Single<WebSocket> |
rxWebSocket(String host,
String requestURI)
Deprecated.
|
Single<WebSocket> |
rxWebSocket(WebSocketConnectOptions options)
Deprecated.
|
Single<WebSocket> |
rxWebSocketAbs(String url,
MultiMap headers,
WebsocketVersion version,
List<String> subProtocols)
Deprecated.
|
String |
toString() |
void |
updateSSLOptions(SSLOptions options)
Like
updateSSLOptions(io.vertx.core.net.SSLOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>>) but supplying a handler that will be called when the update
happened (or has failed). |
void |
updateSSLOptions(SSLOptions options,
boolean force)
Like
updateSSLOptions(io.vertx.core.net.SSLOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>>) but supplying a handler that will be called when the update
happened (or has failed). |
void |
updateSSLOptions(SSLOptions options,
boolean force,
Handler<AsyncResult<Boolean>> handler)
Like
updateSSLOptions(io.vertx.core.net.SSLOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>>) but supplying a handler that will be called when the update
happened (or has failed). |
void |
updateSSLOptions(SSLOptions options,
Handler<AsyncResult<Boolean>> handler)
Like
updateSSLOptions(io.vertx.core.net.SSLOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>>) but supplying a handler that will be called when the update
happened (or has failed). |
void |
webSocket(int port,
String host,
String requestURI)
Deprecated.
|
void |
webSocket(int port,
String host,
String requestURI,
Handler<AsyncResult<WebSocket>> handler)
Deprecated.
|
void |
webSocket(String requestURI)
Deprecated.
|
void |
webSocket(String requestURI,
Handler<AsyncResult<WebSocket>> handler)
Deprecated.
|
void |
webSocket(String host,
String requestURI)
Deprecated.
|
void |
webSocket(String host,
String requestURI,
Handler<AsyncResult<WebSocket>> handler)
Deprecated.
|
void |
webSocket(WebSocketConnectOptions options)
Deprecated.
|
void |
webSocket(WebSocketConnectOptions options,
Handler<AsyncResult<WebSocket>> handler)
Deprecated.
|
void |
webSocketAbs(String url,
MultiMap headers,
WebsocketVersion version,
List<String> subProtocols)
Deprecated.
|
void |
webSocketAbs(String url,
MultiMap headers,
WebsocketVersion version,
List<String> subProtocols,
Handler<AsyncResult<WebSocket>> handler)
Deprecated.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
newInstance
public static final io.vertx.lang.rx.TypeArg<HttpClient> __TYPE_ARG
public HttpClient(HttpClient delegate)
public HttpClient(Object delegate)
public HttpClient getDelegate()
getDelegate
in interface Measured
public boolean isMetricsEnabled()
isMetricsEnabled
in interface Measured
true
if metrics are enabledpublic void request(RequestOptions options, Handler<AsyncResult<HttpClientRequest>> handler)
handler
is called when the request is ready to be sent.options
- the request optionshandler
- the handler called when the request is ready to be sentpublic void request(RequestOptions options)
handler
is called when the request is ready to be sent.options
- the request optionspublic Single<HttpClientRequest> rxRequest(RequestOptions options)
handler
is called when the request is ready to be sent.options
- the request optionspublic void request(HttpMethod method, int port, String host, String requestURI, Handler<AsyncResult<HttpClientRequest>> handler)
host
and port
. The handler
is called when the request is ready to be sent.method
- the HTTP methodport
- the porthost
- the hostrequestURI
- the relative URIhandler
- the handler called when the request is ready to be sentpublic void request(HttpMethod method, int port, String host, String requestURI)
host
and port
. The handler
is called when the request is ready to be sent.method
- the HTTP methodport
- the porthost
- the hostrequestURI
- the relative URIpublic Single<HttpClientRequest> rxRequest(HttpMethod method, int port, String host, String requestURI)
host
and port
. The handler
is called when the request is ready to be sent.method
- the HTTP methodport
- the porthost
- the hostrequestURI
- the relative URIpublic void request(HttpMethod method, String host, String requestURI, Handler<AsyncResult<HttpClientRequest>> handler)
host
and default port. The handler
is called when the request is ready to be sent.method
- the HTTP methodhost
- the hostrequestURI
- the relative URIhandler
- the handler called when the request is ready to be sentpublic void request(HttpMethod method, String host, String requestURI)
host
and default port. The handler
is called when the request is ready to be sent.method
- the HTTP methodhost
- the hostrequestURI
- the relative URIpublic Single<HttpClientRequest> rxRequest(HttpMethod method, String host, String requestURI)
host
and default port. The handler
is called when the request is ready to be sent.method
- the HTTP methodhost
- the hostrequestURI
- the relative URIpublic void request(HttpMethod method, String requestURI, Handler<AsyncResult<HttpClientRequest>> handler)
handler
is called when the request is ready to be sent.method
- the HTTP methodrequestURI
- the relative URIhandler
- the handler called when the request is ready to be sentpublic void request(HttpMethod method, String requestURI)
handler
is called when the request is ready to be sent.method
- the HTTP methodrequestURI
- the relative URIpublic Single<HttpClientRequest> rxRequest(HttpMethod method, String requestURI)
handler
is called when the request is ready to be sent.method
- the HTTP methodrequestURI
- the relative URI@Deprecated public void webSocket(int port, String host, String requestURI, Handler<AsyncResult<WebSocket>> handler)
port
- the porthost
- the hostrequestURI
- the relative URIhandler
- handler that will be called with the WebSocket when connected@Deprecated public void webSocket(int port, String host, String requestURI)
port
- the porthost
- the hostrequestURI
- the relative URI@Deprecated public Single<WebSocket> rxWebSocket(int port, String host, String requestURI)
port
- the porthost
- the hostrequestURI
- the relative URI@Deprecated public void webSocket(String host, String requestURI, Handler<AsyncResult<WebSocket>> handler)
host
- the hostrequestURI
- the relative URIhandler
- handler that will be called with the WebSocket when connected@Deprecated public void webSocket(String host, String requestURI)
host
- the hostrequestURI
- the relative URI@Deprecated public Single<WebSocket> rxWebSocket(String host, String requestURI)
host
- the hostrequestURI
- the relative URI@Deprecated public void webSocket(String requestURI, Handler<AsyncResult<WebSocket>> handler)
requestURI
- the relative URIhandler
- handler that will be called with the WebSocket when connected@Deprecated public void webSocket(String requestURI)
requestURI
- the relative URI@Deprecated public Single<WebSocket> rxWebSocket(String requestURI)
requestURI
- the relative URI@Deprecated public void webSocket(WebSocketConnectOptions options, Handler<AsyncResult<WebSocket>> handler)
options
- the request optionshandler
- @Deprecated public void webSocket(WebSocketConnectOptions options)
options
- the request options@Deprecated public Single<WebSocket> rxWebSocket(WebSocketConnectOptions options)
options
- the request options@Deprecated public void webSocketAbs(String url, MultiMap headers, WebsocketVersion version, List<String> subProtocols, Handler<AsyncResult<WebSocket>> handler)
url
- the absolute urlheaders
- the headersversion
- the WebSocket versionsubProtocols
- the subprotocols to usehandler
- handler that will be called if WebSocket connection fails@Deprecated public void webSocketAbs(String url, MultiMap headers, WebsocketVersion version, List<String> subProtocols)
url
- the absolute urlheaders
- the headersversion
- the WebSocket versionsubProtocols
- the subprotocols to use@Deprecated public Single<WebSocket> rxWebSocketAbs(String url, MultiMap headers, WebsocketVersion version, List<String> subProtocols)
url
- the absolute urlheaders
- the headersversion
- the WebSocket versionsubProtocols
- the subprotocols to usepublic void updateSSLOptions(SSLOptions options, Handler<AsyncResult<Boolean>> handler)
updateSSLOptions(io.vertx.core.net.SSLOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>>)
but supplying a handler that will be called when the update
happened (or has failed).options
- the new SSL optionshandler
- the update handlerpublic void updateSSLOptions(SSLOptions options)
updateSSLOptions(io.vertx.core.net.SSLOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>>)
but supplying a handler that will be called when the update
happened (or has failed).options
- the new SSL optionspublic Single<Boolean> rxUpdateSSLOptions(SSLOptions options)
updateSSLOptions(io.vertx.core.net.SSLOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>>)
but supplying a handler that will be called when the update
happened (or has failed).options
- the new SSL optionspublic void updateSSLOptions(SSLOptions options, boolean force, Handler<AsyncResult<Boolean>> handler)
updateSSLOptions(io.vertx.core.net.SSLOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>>)
but supplying a handler that will be called when the update
happened (or has failed).options
- the new SSL optionsforce
- force the update when options are equalshandler
- the update handlerpublic void updateSSLOptions(SSLOptions options, boolean force)
updateSSLOptions(io.vertx.core.net.SSLOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>>)
but supplying a handler that will be called when the update
happened (or has failed).options
- the new SSL optionsforce
- force the update when options are equalspublic Single<Boolean> rxUpdateSSLOptions(SSLOptions options, boolean force)
updateSSLOptions(io.vertx.core.net.SSLOptions, io.vertx.core.Handler<io.vertx.core.AsyncResult<java.lang.Boolean>>)
but supplying a handler that will be called when the update
happened (or has failed).options
- the new SSL optionsforce
- force the update when options are equals@Deprecated public HttpClient connectionHandler(Handler<HttpConnection> handler)
handler
- @Deprecated public HttpClient redirectHandler(java.util.function.Function<HttpClientResponse,Future<RequestOptions>> handler)
The redirect handler is called when a 3xx
response is received and the request is configured to
follow redirects with HttpClientRequest.setFollowRedirects(boolean)
.
The redirect handler is passed the HttpClientResponse
, it can return an HttpClientRequest
or null
.
Future
is returned, the client will send this new request
The handler must return a Future
unsent so the client can further configure it and send it.
handler
- the new redirect handler@Deprecated public HttpClient redirectHandler(Function<HttpClientResponse,Single<RequestOptions>> handler)
The redirect handler is called when a 3xx
response is received and the request is configured to
follow redirects with HttpClientRequest.setFollowRedirects(boolean)
.
The redirect handler is passed the HttpClientResponse
, it can return an HttpClientRequest
or null
.
Future
is returned, the client will send this new request
The handler must return a Future
unsent so the client can further configure it and send it.
handler
- the new redirect handlerpublic void close(Handler<AsyncResult<Void>> handler)
handler
- public void close()
public Completable rxClose()
public static HttpClient newInstance(HttpClient arg)
Copyright © 2024 Eclipse. All rights reserved.