Class WebClient

  • Direct Known Subclasses:
    OAuth2WebClient, WebClientSession

    public class WebClient
    extends Object
    An asynchronous HTTP / HTTP/2 client called 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.

    NOTE: This class has been automatically generated from the original non Mutiny-ified interface using Vert.x codegen.

    • Constructor Detail

      • WebClient

        public WebClient​(io.vertx.ext.web.client.WebClient delegate)
      • WebClient

        public WebClient​(Object delegate)
    • Method Detail

      • getDelegate

        public io.vertx.ext.web.client.WebClient getDelegate()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • create

        public static WebClient create​(Vertx vertx)
        Parameters:
        vertx - the vertx instance
        Returns:
        the created web client
      • create

        public static WebClient create​(Vertx vertx,
                                       io.vertx.ext.web.client.WebClientOptions options)
        Parameters:
        vertx - the vertx instance
        options - the Web Client options
        Returns:
        the created web client
      • wrap

        public static WebClient wrap​(HttpClient httpClient)
        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 wrap
        options - 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 method
        port - the port
        host - the host
        requestURI - 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 method
        port - the port
        host - the host
        requestURI - 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 method
        host - the host
        requestURI - 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 method
        host - the host
        requestURI - 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,
                                           String requestURI)
        Parameters:
        method - the HTTP method
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • request

        public HttpRequest<Buffer> request​(io.vertx.core.http.HttpMethod method,
                                           UriTemplate requestURI)
        Parameters:
        method - the HTTP method
        requestURI - 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,
                                           io.vertx.core.http.RequestOptions options)
        Parameters:
        method - the HTTP method
        options - 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

        public HttpRequest<Buffer> requestAbs​(io.vertx.core.http.HttpMethod method,
                                              String absoluteURI)
        Parameters:
        method - the HTTP method
        absoluteURI - 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 method
        absoluteURI - 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

        public HttpRequest<Buffer> get​(String requestURI)
        Parameters:
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • get

        public HttpRequest<Buffer> get​(UriTemplate requestURI)
        Parameters:
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • get

        public HttpRequest<Buffer> get​(int port,
                                       String host,
                                       String requestURI)
        Parameters:
        port - the port
        host - the host
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • get

        public HttpRequest<Buffer> get​(int port,
                                       String host,
                                       UriTemplate requestURI)
        Parameters:
        port - the port
        host - the host
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • get

        public HttpRequest<Buffer> get​(String host,
                                       String requestURI)
        Parameters:
        host - the host
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • get

        public HttpRequest<Buffer> get​(String host,
                                       UriTemplate requestURI)
        Parameters:
        host - the host
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • getAbs

        public HttpRequest<Buffer> getAbs​(String absoluteURI)
        Parameters:
        absoluteURI - the absolute URI
        Returns:
        an HTTP client request object
      • getAbs

        public HttpRequest<Buffer> getAbs​(UriTemplate absoluteURI)
        Parameters:
        absoluteURI - the absolute URI as a
        Returns:
        an HTTP client request object
      • post

        public HttpRequest<Buffer> post​(String requestURI)
        Parameters:
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • post

        public HttpRequest<Buffer> post​(UriTemplate requestURI)
        Parameters:
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • post

        public HttpRequest<Buffer> post​(int port,
                                        String host,
                                        String requestURI)
        Parameters:
        port - the port
        host - the host
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • post

        public HttpRequest<Buffer> post​(int port,
                                        String host,
                                        UriTemplate requestURI)
        Parameters:
        port - the port
        host - the host
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • post

        public HttpRequest<Buffer> post​(String host,
                                        String requestURI)
        Parameters:
        host - the host
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • post

        public HttpRequest<Buffer> post​(String host,
                                        UriTemplate requestURI)
        Parameters:
        host - the host
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • postAbs

        public HttpRequest<Buffer> postAbs​(String absoluteURI)
        Parameters:
        absoluteURI - the absolute URI
        Returns:
        an HTTP client request object
      • postAbs

        public HttpRequest<Buffer> postAbs​(UriTemplate absoluteURI)
        Parameters:
        absoluteURI - the absoluate URI as a
        Returns:
        an HTTP client request object
      • put

        public HttpRequest<Buffer> put​(String requestURI)
        Parameters:
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • put

        public HttpRequest<Buffer> put​(UriTemplate requestURI)
        Parameters:
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • put

        public HttpRequest<Buffer> put​(int port,
                                       String host,
                                       String requestURI)
        Parameters:
        port - the port
        host - the host
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • put

        public HttpRequest<Buffer> put​(int port,
                                       String host,
                                       UriTemplate requestURI)
        Parameters:
        port - the port
        host - the host
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • put

        public HttpRequest<Buffer> put​(String host,
                                       String requestURI)
        Parameters:
        host - the host
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • put

        public HttpRequest<Buffer> put​(String host,
                                       UriTemplate requestURI)
        Parameters:
        host - the host
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • putAbs

        public HttpRequest<Buffer> putAbs​(String absoluteURI)
        Parameters:
        absoluteURI - the absolute URI
        Returns:
        an HTTP client request object
      • putAbs

        public HttpRequest<Buffer> putAbs​(UriTemplate absoluteURI)
        Parameters:
        absoluteURI - the absolute URI as a
        Returns:
        an HTTP client request object
      • delete

        public HttpRequest<Buffer> delete​(String requestURI)
        Parameters:
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • delete

        public HttpRequest<Buffer> delete​(UriTemplate requestURI)
        Parameters:
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • delete

        public HttpRequest<Buffer> delete​(int port,
                                          String host,
                                          String requestURI)
        Parameters:
        port - the port
        host - the host
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • delete

        public HttpRequest<Buffer> delete​(int port,
                                          String host,
                                          UriTemplate requestURI)
        Parameters:
        port - the port
        host - the host
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • delete

        public HttpRequest<Buffer> delete​(String host,
                                          String requestURI)
        Parameters:
        host - the host
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • delete

        public HttpRequest<Buffer> delete​(String host,
                                          UriTemplate requestURI)
        Parameters:
        host - the host
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • deleteAbs

        public HttpRequest<Buffer> deleteAbs​(String absoluteURI)
        Parameters:
        absoluteURI - the absolute URI
        Returns:
        an HTTP client request object
      • deleteAbs

        public HttpRequest<Buffer> deleteAbs​(UriTemplate absoluteURI)
        Parameters:
        absoluteURI - the absolute URI as a
        Returns:
        an HTTP client request object
      • patch

        public HttpRequest<Buffer> patch​(String requestURI)
        Parameters:
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • patch

        public HttpRequest<Buffer> patch​(UriTemplate requestURI)
        Parameters:
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • patch

        public HttpRequest<Buffer> patch​(int port,
                                         String host,
                                         String requestURI)
        Parameters:
        port - the port
        host - the host
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • patch

        public HttpRequest<Buffer> patch​(int port,
                                         String host,
                                         UriTemplate requestURI)
        Parameters:
        port - the port
        host - the host
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • patch

        public HttpRequest<Buffer> patch​(String host,
                                         String requestURI)
        Parameters:
        host - the host
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • patch

        public HttpRequest<Buffer> patch​(String host,
                                         UriTemplate requestURI)
        Parameters:
        host - the host
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • patchAbs

        public HttpRequest<Buffer> patchAbs​(String absoluteURI)
        Parameters:
        absoluteURI - the absolute URI
        Returns:
        an HTTP client request object
      • patchAbs

        public HttpRequest<Buffer> patchAbs​(UriTemplate absoluteURI)
        Parameters:
        absoluteURI - the absolute URI as a
        Returns:
        an HTTP client request object
      • head

        public HttpRequest<Buffer> head​(String requestURI)
        Parameters:
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • head

        public HttpRequest<Buffer> head​(UriTemplate requestURI)
        Parameters:
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • head

        public HttpRequest<Buffer> head​(int port,
                                        String host,
                                        String requestURI)
        Parameters:
        port - the port
        host - the host
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • head

        public HttpRequest<Buffer> head​(int port,
                                        String host,
                                        UriTemplate requestURI)
        Parameters:
        port - the port
        host - the host
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • head

        public HttpRequest<Buffer> head​(String host,
                                        String requestURI)
        Parameters:
        host - the host
        requestURI - the request URI
        Returns:
        an HTTP client request object
      • head

        public HttpRequest<Buffer> head​(String host,
                                        UriTemplate requestURI)
        Parameters:
        host - the host
        requestURI - the request URI as a
        Returns:
        an HTTP client request object
      • headAbs

        public HttpRequest<Buffer> headAbs​(String absoluteURI)
        Parameters:
        absoluteURI - the absolute URI
        Returns:
        an HTTP client request object
      • headAbs

        public HttpRequest<Buffer> headAbs​(UriTemplate absoluteURI)
        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)
        Like updateSSLOptions(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

        public Boolean updateSSLOptionsAndAwait​(io.vertx.core.net.SSLOptions options)
        Blocking variant of updateSSLOptions(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 of updateSSLOptions(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 from updateSSLOptions(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)
        Like updateSSLOptions(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
        force - 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

        public Boolean updateSSLOptionsAndAwait​(io.vertx.core.net.SSLOptions options,
                                                boolean force)
        Blocking variant of updateSSLOptions(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 options
        force - 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 of updateSSLOptions(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 from updateSSLOptions(SSLOptions,boolean) but you don't need to compose it with other operations.

        Parameters:
        options - the new SSL options
        force - force the update when options are equals
      • close

        public void close()
      • newInstance

        public static WebClient newInstance​(io.vertx.ext.web.client.WebClient arg)