Class WebClient
- All Implemented Interfaces:
MutinyDelegate
- Direct Known Subclasses:
OAuth2WebClient
,WebClientSession
WebClient
.
The web client makes easy to do HTTP request/response interactions with a web server, and provides advanced features like:
- Json body encoding / decoding
- request/response pumping
- error handling
The web client does not deprecate the , 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.
original
non Mutiny-ified interface using Vert.x codegen.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
static WebClient
static WebClient
delete
(int port, String host, UriTemplate requestURI) delete
(UriTemplate requestURI) delete
(String host, UriTemplate requestURI) deleteAbs
(UriTemplate absoluteURI) boolean
get
(int port, String host, UriTemplate requestURI) get
(UriTemplate requestURI) get
(String host, UriTemplate requestURI) getAbs
(UriTemplate absoluteURI) io.vertx.ext.web.client.WebClient
int
hashCode()
head
(int port, String host, UriTemplate requestURI) head
(UriTemplate requestURI) head
(String host, UriTemplate requestURI) headAbs
(UriTemplate absoluteURI) static WebClient
newInstance
(io.vertx.ext.web.client.WebClient arg) patch
(int port, String host, UriTemplate requestURI) patch
(UriTemplate requestURI) patch
(String host, UriTemplate requestURI) patchAbs
(UriTemplate absoluteURI) post
(int port, String host, UriTemplate requestURI) post
(UriTemplate requestURI) post
(String host, UriTemplate requestURI) postAbs
(UriTemplate absoluteURI) put
(int port, String host, UriTemplate requestURI) put
(UriTemplate requestURI) put
(String host, UriTemplate requestURI) putAbs
(UriTemplate absoluteURI) request
(io.vertx.core.http.HttpMethod method, int port, String host, UriTemplate requestURI) request
(io.vertx.core.http.HttpMethod method, io.vertx.core.http.RequestOptions options) request
(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, int port, String host, UriTemplate requestURI) request
(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, int port, String host, String requestURI) request
(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, io.vertx.core.http.RequestOptions options) request
(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, UriTemplate requestURI) request
(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, String requestURI) request
(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, String host, UriTemplate requestURI) request
(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, String host, String requestURI) request
(io.vertx.core.http.HttpMethod method, UriTemplate requestURI) request
(io.vertx.core.http.HttpMethod method, String host, UriTemplate requestURI) requestAbs
(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, UriTemplate absoluteURI) requestAbs
(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, String absoluteURI) requestAbs
(io.vertx.core.http.HttpMethod method, UriTemplate absoluteURI) requestAbs
(io.vertx.core.http.HttpMethod method, String absoluteURI) toString()
io.smallrye.mutiny.Uni<Boolean>
updateSSLOptions
(io.vertx.core.net.SSLOptions options) LikeupdateSSLOptions(io.vertx.core.net.SSLOptions)
but supplying a handler that will be called when the update happened (or has failed).io.smallrye.mutiny.Uni<Boolean>
updateSSLOptions
(io.vertx.core.net.SSLOptions options, boolean force) LikeupdateSSLOptions(io.vertx.core.net.SSLOptions)
but supplying a handler that will be called when the update happened (or has failed).updateSSLOptionsAndAwait
(io.vertx.core.net.SSLOptions options) Blocking variant ofupdateSSLOptions(SSLOptions)
.updateSSLOptionsAndAwait
(io.vertx.core.net.SSLOptions options, boolean force) Blocking variant ofupdateSSLOptions(SSLOptions,boolean)
.void
updateSSLOptionsAndForget
(io.vertx.core.net.SSLOptions options) Variant ofupdateSSLOptions(SSLOptions)
that ignores the result of the operation.void
updateSSLOptionsAndForget
(io.vertx.core.net.SSLOptions options, boolean force) Variant ofupdateSSLOptions(SSLOptions,boolean)
that ignores the result of the operation.static WebClient
wrap
(HttpClient httpClient) static WebClient
wrap
(HttpClient httpClient, io.vertx.ext.web.client.WebClientOptions options)
-
Field Details
-
__TYPE_ARG
-
-
Constructor Details
-
WebClient
public WebClient(io.vertx.ext.web.client.WebClient delegate) -
WebClient
-
-
Method Details
-
getDelegate
public io.vertx.ext.web.client.WebClient getDelegate()- Specified by:
getDelegate
in interfaceMutinyDelegate
- Returns:
- the delegate used by this Mutiny object of generated type
-
toString
-
equals
-
hashCode
public int hashCode() -
create
- Parameters:
vertx
- the vertx instance- Returns:
- the created web client
-
create
- Parameters:
vertx
- the vertx instanceoptions
- the Web Client options- Returns:
- the created web client
-
wrap
- Parameters:
httpClient
- the to wrap- Returns:
- the web client
-
wrap
public static WebClient wrap(HttpClient httpClient, io.vertx.ext.web.client.WebClientOptions options) - Parameters:
httpClient
- the to wrapoptions
- the Web Client options- Returns:
- the web client
-
request
public HttpRequest<Buffer> request(io.vertx.core.http.HttpMethod method, int port, String host, String requestURI) - Parameters:
method
- the HTTP methodport
- the porthost
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
request
public HttpRequest<Buffer> request(io.vertx.core.http.HttpMethod method, int port, String host, UriTemplate requestURI) - Parameters:
method
- the HTTP methodport
- the porthost
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
request
public HttpRequest<Buffer> request(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, int port, String host, String requestURI) - Parameters:
method
-serverAddress
-port
-host
-requestURI
-- Returns:
-
request
public HttpRequest<Buffer> request(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, int port, String host, UriTemplate requestURI) - Parameters:
method
-serverAddress
-port
-host
-requestURI
-- Returns:
-
request
public HttpRequest<Buffer> request(io.vertx.core.http.HttpMethod method, String host, String requestURI) - Parameters:
method
- the HTTP methodhost
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
request
public HttpRequest<Buffer> request(io.vertx.core.http.HttpMethod method, String host, UriTemplate requestURI) - Parameters:
method
- the HTTP methodhost
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
request
public HttpRequest<Buffer> request(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, String host, String requestURI) - Parameters:
method
-serverAddress
-host
-requestURI
-- Returns:
-
request
public HttpRequest<Buffer> request(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, String host, UriTemplate requestURI) - Parameters:
method
-serverAddress
-host
-requestURI
-- Returns:
-
request
- Parameters:
method
- the HTTP methodrequestURI
- the request URI- Returns:
- an HTTP client request object
-
request
- Parameters:
method
- the HTTP methodrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
request
public HttpRequest<Buffer> request(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, String requestURI) - Parameters:
method
-serverAddress
-requestURI
-- Returns:
-
request
public HttpRequest<Buffer> request(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, UriTemplate requestURI) - Parameters:
method
-serverAddress
-requestURI
-- Returns:
-
request
public HttpRequest<Buffer> request(io.vertx.core.http.HttpMethod method, io.vertx.core.http.RequestOptions options) - Parameters:
method
- the HTTP methodoptions
- the request options- Returns:
- an HTTP client request object
-
request
public HttpRequest<Buffer> request(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, io.vertx.core.http.RequestOptions options) - Parameters:
method
-serverAddress
-options
-- Returns:
-
requestAbs
- Parameters:
method
- the HTTP methodabsoluteURI
- the absolute URI- Returns:
- an HTTP client request object
-
requestAbs
public HttpRequest<Buffer> requestAbs(io.vertx.core.http.HttpMethod method, UriTemplate absoluteURI) - Parameters:
method
- the HTTP methodabsoluteURI
- the absolute URI as a- Returns:
- an HTTP client request object
-
requestAbs
public HttpRequest<Buffer> requestAbs(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, String absoluteURI) - Parameters:
method
-serverAddress
-absoluteURI
-- Returns:
-
requestAbs
public HttpRequest<Buffer> requestAbs(io.vertx.core.http.HttpMethod method, SocketAddress serverAddress, UriTemplate absoluteURI) - Parameters:
method
-serverAddress
-absoluteURI
-- Returns:
-
get
- Parameters:
requestURI
- the request URI- Returns:
- an HTTP client request object
-
get
- Parameters:
requestURI
- the request URI as a- Returns:
- an HTTP client request object
-
get
- Parameters:
port
- the porthost
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
get
- Parameters:
port
- the porthost
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
get
- Parameters:
host
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
get
- Parameters:
host
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
getAbs
- Parameters:
absoluteURI
- the absolute URI- Returns:
- an HTTP client request object
-
getAbs
- Parameters:
absoluteURI
- the absolute URI as a- Returns:
- an HTTP client request object
-
post
- Parameters:
requestURI
- the request URI- Returns:
- an HTTP client request object
-
post
- Parameters:
requestURI
- the request URI as a- Returns:
- an HTTP client request object
-
post
- Parameters:
port
- the porthost
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
post
- Parameters:
port
- the porthost
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
post
- Parameters:
host
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
post
- Parameters:
host
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
postAbs
- Parameters:
absoluteURI
- the absolute URI- Returns:
- an HTTP client request object
-
postAbs
- Parameters:
absoluteURI
- the absoluate URI as a- Returns:
- an HTTP client request object
-
put
- Parameters:
requestURI
- the request URI- Returns:
- an HTTP client request object
-
put
- Parameters:
requestURI
- the request URI as a- Returns:
- an HTTP client request object
-
put
- Parameters:
port
- the porthost
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
put
- Parameters:
port
- the porthost
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
put
- Parameters:
host
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
put
- Parameters:
host
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
putAbs
- Parameters:
absoluteURI
- the absolute URI- Returns:
- an HTTP client request object
-
putAbs
- Parameters:
absoluteURI
- the absolute URI as a- Returns:
- an HTTP client request object
-
delete
- Parameters:
requestURI
- the request URI- Returns:
- an HTTP client request object
-
delete
- Parameters:
requestURI
- the request URI as a- Returns:
- an HTTP client request object
-
delete
- Parameters:
port
- the porthost
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
delete
- Parameters:
port
- the porthost
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
delete
- Parameters:
host
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
delete
- Parameters:
host
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
deleteAbs
- Parameters:
absoluteURI
- the absolute URI- Returns:
- an HTTP client request object
-
deleteAbs
- Parameters:
absoluteURI
- the absolute URI as a- Returns:
- an HTTP client request object
-
patch
- Parameters:
requestURI
- the request URI- Returns:
- an HTTP client request object
-
patch
- Parameters:
requestURI
- the request URI as a- Returns:
- an HTTP client request object
-
patch
- Parameters:
port
- the porthost
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
patch
- Parameters:
port
- the porthost
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
patch
- Parameters:
host
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
patch
- Parameters:
host
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
patchAbs
- Parameters:
absoluteURI
- the absolute URI- Returns:
- an HTTP client request object
-
patchAbs
- Parameters:
absoluteURI
- the absolute URI as a- Returns:
- an HTTP client request object
-
head
- Parameters:
requestURI
- the request URI- Returns:
- an HTTP client request object
-
head
- Parameters:
requestURI
- the request URI as a- Returns:
- an HTTP client request object
-
head
- Parameters:
port
- the porthost
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
head
- Parameters:
port
- the porthost
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
head
- Parameters:
host
- the hostrequestURI
- the request URI- Returns:
- an HTTP client request object
-
head
- Parameters:
host
- the hostrequestURI
- the request URI as a- Returns:
- an HTTP client request object
-
headAbs
- Parameters:
absoluteURI
- the absolute URI- Returns:
- an HTTP client request object
-
headAbs
- Parameters:
absoluteURI
- the absolute URI as a- Returns:
- an HTTP client request object
-
updateSSLOptions
@CheckReturnValue public io.smallrye.mutiny.Uni<Boolean> updateSSLOptions(io.vertx.core.net.SSLOptions options) LikeupdateSSLOptions(io.vertx.core.net.SSLOptions)
but supplying a handler that will be called when the update happened (or has failed).Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
options
- the new SSL options- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
updateSSLOptionsAndAwait
Blocking variant ofupdateSSLOptions(SSLOptions)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
options
- the new SSL options- Returns:
- the Boolean instance produced by the operation.
-
updateSSLOptionsAndForget
public void updateSSLOptionsAndForget(io.vertx.core.net.SSLOptions options) Variant ofupdateSSLOptions(SSLOptions)
that ignores the result of the operation.This method subscribes on the result of
updateSSLOptions(SSLOptions)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromupdateSSLOptions(SSLOptions)
but you don't need to compose it with other operations.- Parameters:
options
- the new SSL options
-
updateSSLOptions
@CheckReturnValue public io.smallrye.mutiny.Uni<Boolean> updateSSLOptions(io.vertx.core.net.SSLOptions options, boolean force) LikeupdateSSLOptions(io.vertx.core.net.SSLOptions)
but supplying a handler that will be called when the update happened (or has failed).Unlike the bare Vert.x variant, this method returns a
Uni
. Don't forget to subscribe on it to trigger the operation.- Parameters:
options
- the new SSL optionsforce
- force the update when options are equals- Returns:
- the
uni
firing the result of the operation when completed, or a failure if the operation failed.
-
updateSSLOptionsAndAwait
Blocking variant ofupdateSSLOptions(SSLOptions,boolean)
.This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).
- Parameters:
options
- the new SSL optionsforce
- force the update when options are equals- Returns:
- the Boolean instance produced by the operation.
-
updateSSLOptionsAndForget
public void updateSSLOptionsAndForget(io.vertx.core.net.SSLOptions options, boolean force) Variant ofupdateSSLOptions(SSLOptions,boolean)
that ignores the result of the operation.This method subscribes on the result of
updateSSLOptions(SSLOptions,boolean)
, but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation fromupdateSSLOptions(SSLOptions,boolean)
but you don't need to compose it with other operations.- Parameters:
options
- the new SSL optionsforce
- force the update when options are equals
-
close
public void close() -
newInstance
-