public interface WebClient
WebClient
.
The web client makes easy to do HTTP request/response interactions with a web server, and provides advanced features like:
The web client does not deprecate the HttpClient
, it is actually based on it and therefore inherits
its configuration and great features like pooling. The HttpClient
should be used when fine grained control over the HTTP
requests/response is necessary.
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the client.
|
static WebClient |
create(Vertx vertx)
Create a web client using the provided
vertx instance and default options. |
static WebClient |
create(Vertx vertx,
WebClientOptions options)
Create a web client using the provided
vertx instance. |
default HttpRequest<Buffer> |
delete(int port,
String host,
String requestURI)
Create an HTTP DELETE request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
delete(int port,
String host,
UriTemplate requestURI)
Create an HTTP DELETE request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
delete(String requestURI)
Create an HTTP DELETE request to send to the server at the default host and port.
|
default HttpRequest<Buffer> |
delete(String host,
String requestURI)
Create an HTTP DELETE request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
delete(String host,
UriTemplate requestURI)
Create an HTTP DELETE request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
delete(UriTemplate requestURI)
Create an HTTP DELETE request to send to the server at the default host and port.
|
default HttpRequest<Buffer> |
deleteAbs(String absoluteURI)
Create an HTTP DELETE request to send to the server using an absolute URI, specifying a response handler to receive
the response
|
default HttpRequest<Buffer> |
deleteAbs(UriTemplate absoluteURI)
Create an HTTP DELETE request to send to the server using an absolute URI, specifying a response handler to receive
the response
|
default HttpRequest<Buffer> |
get(int port,
String host,
String requestURI)
Create an HTTP GET request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
get(int port,
String host,
UriTemplate requestURI)
Create an HTTP GET request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
get(String requestURI)
Create an HTTP GET request to send to the server at the default host and port.
|
default HttpRequest<Buffer> |
get(String host,
String requestURI)
Create an HTTP GET request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
get(String host,
UriTemplate requestURI)
Create an HTTP GET request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
get(UriTemplate requestURI)
Create an HTTP GET request to send to the server at the default host and port.
|
default HttpRequest<Buffer> |
getAbs(String absoluteURI)
Create an HTTP GET request to send to the server using an absolute URI, specifying a response handler to receive
the response
|
default HttpRequest<Buffer> |
getAbs(UriTemplate absoluteURI)
Create an HTTP GET request to send to the server using an absolute URI, specifying a response handler to receive
the response
|
default HttpRequest<Buffer> |
head(int port,
String host,
String requestURI)
Create an HTTP HEAD request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
head(int port,
String host,
UriTemplate requestURI)
Create an HTTP HEAD request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
head(String requestURI)
Create an HTTP HEAD request to send to the server at the default host and port.
|
default HttpRequest<Buffer> |
head(String host,
String requestURI)
Create an HTTP HEAD request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
head(String host,
UriTemplate requestURI)
Create an HTTP HEAD request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
head(UriTemplate requestURI)
Create an HTTP HEAD request to send to the server at the default host and port.
|
default HttpRequest<Buffer> |
headAbs(String absoluteURI)
Create an HTTP HEAD request to send to the server using an absolute URI, specifying a response handler to receive
the response
|
default HttpRequest<Buffer> |
headAbs(UriTemplate absoluteURI)
Create an HTTP HEAD request to send to the server using an absolute URI, specifying a response handler to receive
the response
|
default HttpRequest<Buffer> |
patch(int port,
String host,
String requestURI)
Create an HTTP PATCH request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
patch(int port,
String host,
UriTemplate requestURI)
Create an HTTP PATCH request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
patch(String requestURI)
Create an HTTP PATCH request to send to the server at the default host and port.
|
default HttpRequest<Buffer> |
patch(String host,
String requestURI)
Create an HTTP PATCH request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
patch(String host,
UriTemplate requestURI)
Create an HTTP PATCH request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
patch(UriTemplate requestURI)
Create an HTTP PATCH request to send to the server at the default host and port.
|
default HttpRequest<Buffer> |
patchAbs(String absoluteURI)
Create an HTTP PATCH request to send to the server using an absolute URI, specifying a response handler to receive
the response
|
default HttpRequest<Buffer> |
patchAbs(UriTemplate absoluteURI)
Create an HTTP PATCH request to send to the server using an absolute URI, specifying a response handler to receive
the response
|
default HttpRequest<Buffer> |
post(int port,
String host,
String requestURI)
Create an HTTP POST request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
post(int port,
String host,
UriTemplate requestURI)
Create an HTTP POST request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
post(String requestURI)
Create an HTTP POST request to send to the server at the default host and port.
|
default HttpRequest<Buffer> |
post(String host,
String requestURI)
Create an HTTP POST request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
post(String host,
UriTemplate requestURI)
Create an HTTP POST request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
post(UriTemplate requestURI)
Create an HTTP POST request to send to the server at the default host and port.
|
default HttpRequest<Buffer> |
postAbs(String absoluteURI)
Create an HTTP POST request to send to the server using an absolute URI, specifying a response handler to receive
the response
|
default HttpRequest<Buffer> |
postAbs(UriTemplate absoluteURI)
Create an HTTP POST request to send to the server using an absolute URI, specifying a response handler to receive
the response
|
default HttpRequest<Buffer> |
put(int port,
String host,
String requestURI)
Create an HTTP PUT request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
put(int port,
String host,
UriTemplate requestURI)
Create an HTTP PUT request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
put(String requestURI)
Create an HTTP PUT request to send to the server at the default host and port.
|
default HttpRequest<Buffer> |
put(String host,
String requestURI)
Create an HTTP PUT request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
put(String host,
UriTemplate requestURI)
Create an HTTP PUT request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
put(UriTemplate requestURI)
Create an HTTP PUT request to send to the server at the default host and port.
|
default HttpRequest<Buffer> |
putAbs(String absoluteURI)
Create an HTTP PUT request to send to the server using an absolute URI, specifying a response handler to receive
the response
|
default HttpRequest<Buffer> |
putAbs(UriTemplate absoluteURI)
Create an HTTP PUT request to send to the server using an absolute URI, specifying a response handler to receive
the response
|
default HttpRequest<Buffer> |
request(HttpMethod method,
int port,
String host,
String requestURI)
Create an HTTP request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
request(HttpMethod method,
int port,
String host,
UriTemplate requestURI)
Create an HTTP request to send to the server at the specified host and port.
|
default HttpRequest<Buffer> |
request(HttpMethod method,
RequestOptions options)
Create an HTTP request to send to the server at the specified host and port.
|
HttpRequest<Buffer> |
request(HttpMethod method,
SocketAddress serverAddress,
int port,
String host,
String requestURI)
Like
request(HttpMethod, int, String, String) using the serverAddress parameter to connect to the
server instead of the port and host parameters. |
HttpRequest<Buffer> |
request(HttpMethod method,
SocketAddress serverAddress,
int port,
String host,
UriTemplate requestURI)
Like
request(HttpMethod, int, String, UriTemplate) using the serverAddress parameter to connect to the
server instead of the port and host parameters. |
HttpRequest<Buffer> |
request(HttpMethod method,
SocketAddress serverAddress,
RequestOptions options)
Like
request(HttpMethod, RequestOptions) using the serverAddress parameter to connect to the
server instead of the options parameter. |
HttpRequest<Buffer> |
request(HttpMethod method,
SocketAddress serverAddress,
String requestURI)
Like
request(HttpMethod, String) using the serverAddress parameter to connect to the
server instead of the default port and default host. |
HttpRequest<Buffer> |
request(HttpMethod method,
SocketAddress serverAddress,
String host,
String requestURI)
Like
request(HttpMethod, String, String) using the serverAddress parameter to connect to the
server instead of the default port and host parameter. |
HttpRequest<Buffer> |
request(HttpMethod method,
SocketAddress serverAddress,
String host,
UriTemplate requestURI)
Like
request(HttpMethod, String, UriTemplate) using the serverAddress parameter to connect to the
server instead of the default port and host parameter. |
HttpRequest<Buffer> |
request(HttpMethod method,
SocketAddress serverAddress,
UriTemplate requestURI)
Like
request(HttpMethod, UriTemplate) using the serverAddress parameter to connect to the
server instead of the default port and default host. |
default HttpRequest<Buffer> |
request(HttpMethod method,
String requestURI)
Create an HTTP request to send to the server at the default host and port.
|
default HttpRequest<Buffer> |
request(HttpMethod method,
String host,
String requestURI)
Create an HTTP request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
request(HttpMethod method,
String host,
UriTemplate requestURI)
Create an HTTP request to send to the server at the specified host and default port.
|
default HttpRequest<Buffer> |
request(HttpMethod method,
UriTemplate requestURI)
Create an HTTP request to send to the server at the default host and port.
|
HttpRequest<Buffer> |
requestAbs(HttpMethod method,
SocketAddress serverAddress,
String absoluteURI)
Like
requestAbs(HttpMethod, String) using the serverAddress parameter to connect to the
server instead of the absoluteURI parameter. |
HttpRequest<Buffer> |
requestAbs(HttpMethod method,
SocketAddress serverAddress,
UriTemplate absoluteURI)
Like
requestAbs(HttpMethod, UriTemplate) using the serverAddress parameter to connect to the
server instead of the absoluteURI parameter. |
default HttpRequest<Buffer> |
requestAbs(HttpMethod method,
String absoluteURI)
Create an HTTP request to send to the server using an absolute URI
|
default HttpRequest<Buffer> |
requestAbs(HttpMethod method,
UriTemplate absoluteURI)
Create an HTTP request to send to the server using an absolute URI
|
default Future<Boolean> |
updateSSLOptions(SSLOptions options)
Update the client with new SSL
options , the update happens if the options object is valid and different
from the existing options object. |
Future<Boolean> |
updateSSLOptions(SSLOptions options,
boolean force)
Update the client with new SSL
options , the update happens if the options object is valid and different
from the existing options object. |
default void |
updateSSLOptions(SSLOptions options,
boolean force,
Handler<AsyncResult<Boolean>> handler)
Like
updateSSLOptions(SSLOptions) but supplying a handler that will be called when the update
happened (or has failed). |
default void |
updateSSLOptions(SSLOptions options,
Handler<AsyncResult<Boolean>> handler)
Like
updateSSLOptions(SSLOptions) but supplying a handler that will be called when the update
happened (or has failed). |
static WebClient |
wrap(HttpClient httpClient)
Wrap an
httpClient with a web client and default options. |
static WebClient |
wrap(HttpClient httpClient,
WebClientOptions options)
Wrap an
httpClient with a web client and default options. |
static WebClient create(Vertx vertx)
vertx
instance and default options.vertx
- the vertx instancestatic WebClient create(Vertx vertx, WebClientOptions options)
vertx
instance.vertx
- the vertx instanceoptions
- the Web Client optionsstatic WebClient wrap(HttpClient httpClient)
httpClient
with a web client and default options.httpClient
- the HttpClient
to wrapstatic WebClient wrap(HttpClient httpClient, WebClientOptions options)
httpClient
with a web client and default options.
Only the specific web client portion of the options
is used, the HttpClientOptions
of the httpClient
is reused.
httpClient
- the HttpClient
to wrapoptions
- the Web Client optionsdefault HttpRequest<Buffer> request(HttpMethod method, int port, String host, String requestURI)
method
- the HTTP methodport
- the porthost
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> request(HttpMethod method, int port, String host, UriTemplate requestURI)
method
- the HTTP methodport
- the porthost
- the hostrequestURI
- the request URI as a UriTemplate
HttpRequest<Buffer> request(HttpMethod method, SocketAddress serverAddress, int port, String host, String requestURI)
request(HttpMethod, int, String, String)
using the serverAddress
parameter to connect to the
server instead of the port
and host
parameters.
The request host header will still be created from the port
and host
parameters.
Use SocketAddress.domainSocketAddress(String)
to connect to a unix domain socket server.
HttpRequest<Buffer> request(HttpMethod method, SocketAddress serverAddress, int port, String host, UriTemplate requestURI)
request(HttpMethod, int, String, UriTemplate)
using the serverAddress
parameter to connect to the
server instead of the port
and host
parameters.
The request host header will still be created from the port
and host
parameters.
Use SocketAddress.domainSocketAddress(String)
to connect to a unix domain socket server.
default HttpRequest<Buffer> request(HttpMethod method, String host, String requestURI)
method
- the HTTP methodhost
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> request(HttpMethod method, String host, UriTemplate requestURI)
method
- the HTTP methodhost
- the hostrequestURI
- the request URI as a UriTemplate
HttpRequest<Buffer> request(HttpMethod method, SocketAddress serverAddress, String host, String requestURI)
request(HttpMethod, String, String)
using the serverAddress
parameter to connect to the
server instead of the default port and host
parameter.
The request host header will still be created from the default port and host
parameter.
Use SocketAddress.domainSocketAddress(String)
to connect to a unix domain socket server.
HttpRequest<Buffer> request(HttpMethod method, SocketAddress serverAddress, String host, UriTemplate requestURI)
request(HttpMethod, String, UriTemplate)
using the serverAddress
parameter to connect to the
server instead of the default port and host
parameter.
The request host header will still be created from the default port and host
parameter.
Use SocketAddress.domainSocketAddress(String)
to connect to a unix domain socket server.
default HttpRequest<Buffer> request(HttpMethod method, String requestURI)
method
- the HTTP methodrequestURI
- the request URIdefault HttpRequest<Buffer> request(HttpMethod method, UriTemplate requestURI)
method
- the HTTP methodrequestURI
- the request URI as a UriTemplate
HttpRequest<Buffer> request(HttpMethod method, SocketAddress serverAddress, String requestURI)
request(HttpMethod, String)
using the serverAddress
parameter to connect to the
server instead of the default port and default host.
The request host header will still be created from the default port and default host.
Use SocketAddress.domainSocketAddress(String)
to connect to a unix domain socket server.
HttpRequest<Buffer> request(HttpMethod method, SocketAddress serverAddress, UriTemplate requestURI)
request(HttpMethod, UriTemplate)
using the serverAddress
parameter to connect to the
server instead of the default port and default host.
The request host header will still be created from the default port and default host.
Use SocketAddress.domainSocketAddress(String)
to connect to a unix domain socket server.
default HttpRequest<Buffer> request(HttpMethod method, RequestOptions options)
method
- the HTTP methodoptions
- the request optionsHttpRequest<Buffer> request(HttpMethod method, SocketAddress serverAddress, RequestOptions options)
request(HttpMethod, RequestOptions)
using the serverAddress
parameter to connect to the
server instead of the options
parameter.
The request host header will still be created from the options
parameter.
Use SocketAddress.domainSocketAddress(String)
to connect to a unix domain socket server.
default HttpRequest<Buffer> requestAbs(HttpMethod method, String absoluteURI)
method
- the HTTP methodabsoluteURI
- the absolute URIdefault HttpRequest<Buffer> requestAbs(HttpMethod method, UriTemplate absoluteURI)
method
- the HTTP methodabsoluteURI
- the absolute URI as a UriTemplate
HttpRequest<Buffer> requestAbs(HttpMethod method, SocketAddress serverAddress, String absoluteURI)
requestAbs(HttpMethod, String)
using the serverAddress
parameter to connect to the
server instead of the absoluteURI
parameter.
The request host header will still be created from the absoluteURI
parameter.
Use SocketAddress.domainSocketAddress(String)
to connect to a unix domain socket server.
HttpRequest<Buffer> requestAbs(HttpMethod method, SocketAddress serverAddress, UriTemplate absoluteURI)
requestAbs(HttpMethod, UriTemplate)
using the serverAddress
parameter to connect to the
server instead of the absoluteURI
parameter.
The request host header will still be created from the absoluteURI
parameter.
Use SocketAddress.domainSocketAddress(String)
to connect to a unix domain socket server.
default HttpRequest<Buffer> get(String requestURI)
requestURI
- the request URIdefault HttpRequest<Buffer> get(UriTemplate requestURI)
requestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> get(int port, String host, String requestURI)
port
- the porthost
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> get(int port, String host, UriTemplate requestURI)
port
- the porthost
- the hostrequestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> get(String host, String requestURI)
host
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> get(String host, UriTemplate requestURI)
host
- the hostrequestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> getAbs(String absoluteURI)
absoluteURI
- the absolute URIdefault HttpRequest<Buffer> getAbs(UriTemplate absoluteURI)
absoluteURI
- the absolute URI as a UriTemplate
default HttpRequest<Buffer> post(String requestURI)
requestURI
- the request URIdefault HttpRequest<Buffer> post(UriTemplate requestURI)
requestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> post(int port, String host, String requestURI)
port
- the porthost
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> post(int port, String host, UriTemplate requestURI)
port
- the porthost
- the hostrequestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> post(String host, String requestURI)
host
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> post(String host, UriTemplate requestURI)
host
- the hostrequestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> postAbs(String absoluteURI)
absoluteURI
- the absolute URIdefault HttpRequest<Buffer> postAbs(UriTemplate absoluteURI)
absoluteURI
- the absoluate URI as a UriTemplate
default HttpRequest<Buffer> put(String requestURI)
requestURI
- the request URIdefault HttpRequest<Buffer> put(UriTemplate requestURI)
requestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> put(int port, String host, String requestURI)
port
- the porthost
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> put(int port, String host, UriTemplate requestURI)
port
- the porthost
- the hostrequestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> put(String host, String requestURI)
host
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> put(String host, UriTemplate requestURI)
host
- the hostrequestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> putAbs(String absoluteURI)
absoluteURI
- the absolute URIdefault HttpRequest<Buffer> putAbs(UriTemplate absoluteURI)
absoluteURI
- the absolute URI as a UriTemplate
default HttpRequest<Buffer> delete(String requestURI)
requestURI
- the request URIdefault HttpRequest<Buffer> delete(UriTemplate requestURI)
requestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> delete(int port, String host, String requestURI)
port
- the porthost
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> delete(int port, String host, UriTemplate requestURI)
port
- the porthost
- the hostrequestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> delete(String host, String requestURI)
host
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> delete(String host, UriTemplate requestURI)
host
- the hostrequestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> deleteAbs(String absoluteURI)
absoluteURI
- the absolute URIdefault HttpRequest<Buffer> deleteAbs(UriTemplate absoluteURI)
absoluteURI
- the absolute URI as a UriTemplate
default HttpRequest<Buffer> patch(String requestURI)
requestURI
- the request URIdefault HttpRequest<Buffer> patch(UriTemplate requestURI)
requestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> patch(int port, String host, String requestURI)
port
- the porthost
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> patch(int port, String host, UriTemplate requestURI)
port
- the porthost
- the hostrequestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> patch(String host, String requestURI)
host
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> patch(String host, UriTemplate requestURI)
host
- the hostrequestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> patchAbs(String absoluteURI)
absoluteURI
- the absolute URIdefault HttpRequest<Buffer> patchAbs(UriTemplate absoluteURI)
absoluteURI
- the absolute URI as a UriTemplate
default HttpRequest<Buffer> head(String requestURI)
requestURI
- the request URIdefault HttpRequest<Buffer> head(UriTemplate requestURI)
requestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> head(int port, String host, String requestURI)
port
- the porthost
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> head(int port, String host, UriTemplate requestURI)
port
- the porthost
- the hostrequestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> head(String host, String requestURI)
host
- the hostrequestURI
- the request URIdefault HttpRequest<Buffer> head(String host, UriTemplate requestURI)
host
- the hostrequestURI
- the request URI as a UriTemplate
default HttpRequest<Buffer> headAbs(String absoluteURI)
absoluteURI
- the absolute URIdefault HttpRequest<Buffer> headAbs(UriTemplate absoluteURI)
absoluteURI
- the absolute URI as a UriTemplate
default Future<Boolean> updateSSLOptions(SSLOptions options)
Update the client with new SSL options
, the update happens if the options object is valid and different
from the existing options object.
The boolean succeeded future result indicates whether the update occurred.
options
- the new SSL optionsdefault void updateSSLOptions(SSLOptions options, Handler<AsyncResult<Boolean>> handler)
updateSSLOptions(SSLOptions)
but supplying a handler that will be called when the update
happened (or has failed).options
- the new SSL optionshandler
- the update handlerFuture<Boolean> updateSSLOptions(SSLOptions options, boolean force)
Update the client with new SSL options
, the update happens if the options object is valid and different
from the existing options object.
The options
object is compared using its equals
method against the existing options to prevent
an update when the objects are equals since loading options can be costly, this can happen for share TCP servers.
When object are equals, setting force
to true
forces the update.
The boolean succeeded future result indicates whether the update occurred.
options
- the new SSL optionsforce
- force the update when options are equalsdefault void updateSSLOptions(SSLOptions options, boolean force, Handler<AsyncResult<Boolean>> handler)
updateSSLOptions(SSLOptions)
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 handlervoid close()
Copyright © 2024 Eclipse. All rights reserved.