io.vertx.rxjava3.core.http

## Class HttpClient

- java.lang.Object
- - io.vertx.rxjava3.core.http.HttpClient

- All Implemented Interfaces:
    Measured

      public class HttpClient
      extends Object
      implements Measured

  An asynchronous HTTP client.

  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 the `original` non RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static io.vertx.lang.rx.TypeArg<HttpClient>` | `__TYPE_ARG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpClient(HttpClient delegate)`
    `HttpClient(Object delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `Completable` | `close()` 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,Single<RequestOptions>> handler)` Deprecated.
    `Single<HttpClientRequest>` | `request(HttpMethod method, int port, String host, String requestURI)` Create an HTTP request to send to the server at the `host` and `port`.
    `Single<HttpClientRequest>` | `request(HttpMethod method, String requestURI)` Create an HTTP request to send to the server at the default host and port.
    `Single<HttpClientRequest>` | `request(HttpMethod method, String host, String requestURI)` Create an HTTP request to send to the server at the `host` and default port.
    `Single<HttpClientRequest>` | `request(RequestOptions options)` 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)` 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)` 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()`
    `Single<Boolean>` | `updateSSLOptions(SSLOptions options)` Like `updateSSLOptions(io.vertx.core.net.SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
    `Single<Boolean>` | `updateSSLOptions(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).
    `Single<WebSocket>` | `webSocket(int port, String host, String requestURI)` Deprecated.
    `Single<WebSocket>` | `webSocket(String requestURI)` Deprecated.
    `Single<WebSocket>` | `webSocket(String host, String requestURI)` Deprecated.
    `Single<WebSocket>` | `webSocket(WebSocketConnectOptions options)` Deprecated.
    `Single<WebSocket>` | `webSocketAbs(String url, MultiMap headers, WebsocketVersion version, List<String> subProtocols)` Deprecated.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface io.vertx.rxjava3.core.metrics.Measured

      `newInstance`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<HttpClient> __TYPE_ARG

  - ### Constructor Detail

    - #### HttpClient

          public HttpClient(HttpClient delegate)

    - #### HttpClient

          public HttpClient(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public HttpClient getDelegate()

      Specified by:
        `getDelegate` in interface `Measured`

    - #### isMetricsEnabled

          public boolean isMetricsEnabled()

      Whether the metrics are enabled for this measured object
      Specified by:
        `isMetricsEnabled` in interface `Measured`
      Returns:
        `true` if metrics are enabled

    - #### request

          public Single<HttpClientRequest> request(RequestOptions options)

      Create an HTTP request to send to the server. The `handler` is called when the request is ready to be sent.
      Parameters:
        `options` - the request options
      Returns:

    - #### rxRequest

          public Single<HttpClientRequest> rxRequest(RequestOptions options)

      Create an HTTP request to send to the server. The `handler` is called when the request is ready to be sent.
      Parameters:
        `options` - the request options
      Returns:

    - #### request

          public Single<HttpClientRequest> request(HttpMethod method,
                                                   int port,
                                                   String host,
                                                   String requestURI)

      Create an HTTP request to send to the server at the `host` and `port`. The `handler` is called when the request is ready to be sent.
      Parameters:
        `method` - the HTTP method
        `port` - the port
        `host` - the host
        `requestURI` - the relative URI
      Returns:

    - #### rxRequest

          public 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`. The `handler` is called when the request is ready to be sent.
      Parameters:
        `method` - the HTTP method
        `port` - the port
        `host` - the host
        `requestURI` - the relative URI
      Returns:

    - #### request

          public Single<HttpClientRequest> request(HttpMethod method,
                                                   String host,
                                                   String requestURI)

      Create an HTTP request to send to the server at the `host` and default port. The `handler` is called when the request is ready to be sent.
      Parameters:
        `method` - the HTTP method
        `host` - the host
        `requestURI` - the relative URI
      Returns:

    - #### rxRequest

          public Single<HttpClientRequest> rxRequest(HttpMethod method,
                                                     String host,
                                                     String requestURI)

      Create an HTTP request to send to the server at the `host` and default port. The `handler` is called when the request is ready to be sent.
      Parameters:
        `method` - the HTTP method
        `host` - the host
        `requestURI` - the relative URI
      Returns:

    - #### request

          public Single<HttpClientRequest> request(HttpMethod method,
                                                   String requestURI)

      Create an HTTP request to send to the server at the default host and port. The `handler` is called when the request is ready to be sent.
      Parameters:
        `method` - the HTTP method
        `requestURI` - the relative URI
      Returns:

    - #### rxRequest

          public Single<HttpClientRequest> rxRequest(HttpMethod method,
                                                     String requestURI)

      Create an HTTP request to send to the server at the default host and port. The `handler` is called when the request is ready to be sent.
      Parameters:
        `method` - the HTTP method
        `requestURI` - the relative URI
      Returns:

    - #### webSocket

          @Deprecated
          public Single<WebSocket> webSocket(int port,
                                                         String host,
                                                         String requestURI)

      Deprecated.
      Connect a WebSocket to the specified port, host and relative request URI
      Parameters:
        `port` - the port
        `host` - the host
        `requestURI` - the relative URI
      Returns:

    - #### rxWebSocket

          @Deprecated
          public Single<WebSocket> rxWebSocket(int port,
                                                           String host,
                                                           String requestURI)

      Deprecated.
      Connect a WebSocket to the specified port, host and relative request URI
      Parameters:
        `port` - the port
        `host` - the host
        `requestURI` - the relative URI
      Returns:

    - #### webSocket

          @Deprecated
          public Single<WebSocket> webSocket(String host,
                                                         String requestURI)

      Deprecated.
      Connect a WebSocket to the host and relative request URI and default port
      Parameters:
        `host` - the host
        `requestURI` - the relative URI
      Returns:

    - #### rxWebSocket

          @Deprecated
          public Single<WebSocket> rxWebSocket(String host,
                                                           String requestURI)

      Deprecated.
      Connect a WebSocket to the host and relative request URI and default port
      Parameters:
        `host` - the host
        `requestURI` - the relative URI
      Returns:

    - #### webSocket

          @Deprecated
          public Single<WebSocket> webSocket(String requestURI)

      Deprecated.
      Connect a WebSocket at the relative request URI using the default host and port
      Parameters:
        `requestURI` - the relative URI
      Returns:

    - #### rxWebSocket

          @Deprecated
          public Single<WebSocket> rxWebSocket(String requestURI)

      Deprecated.
      Connect a WebSocket at the relative request URI using the default host and port
      Parameters:
        `requestURI` - the relative URI
      Returns:

    - #### webSocket

          @Deprecated
          public Single<WebSocket> webSocket(WebSocketConnectOptions options)

      Deprecated.
      Connect a WebSocket with the specified options.
      Parameters:
        `options` - the request options
      Returns:

    - #### rxWebSocket

          @Deprecated
          public Single<WebSocket> rxWebSocket(WebSocketConnectOptions options)

      Deprecated.
      Connect a WebSocket with the specified options.
      Parameters:
        `options` - the request options
      Returns:

    - #### webSocketAbs

          @Deprecated
          public Single<WebSocket> webSocketAbs(String url,
                                                            MultiMap headers,
                                                            WebsocketVersion version,
                                                            List<String> subProtocols)

      Deprecated.
      Connect a WebSocket with the specified absolute url, with the specified headers, using the specified version of WebSockets, and the specified WebSocket sub protocols.
      Parameters:
        `url` - the absolute url
        `headers` - the headers
        `version` - the WebSocket version
        `subProtocols` - the subprotocols to use
      Returns:

    - #### rxWebSocketAbs

          @Deprecated
          public Single<WebSocket> rxWebSocketAbs(String url,
                                                              MultiMap headers,
                                                              WebsocketVersion version,
                                                              List<String> subProtocols)

      Deprecated.
      Connect a WebSocket with the specified absolute url, with the specified headers, using the specified version of WebSockets, and the specified WebSocket sub protocols.
      Parameters:
        `url` - the absolute url
        `headers` - the headers
        `version` - the WebSocket version
        `subProtocols` - the subprotocols to use
      Returns:

    - #### updateSSLOptions

          public Single<Boolean> updateSSLOptions(SSLOptions options)

      Like `updateSSLOptions(io.vertx.core.net.SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
      Parameters:
        `options` - the new SSL options
      Returns:

    - #### rxUpdateSSLOptions

          public Single<Boolean> rxUpdateSSLOptions(SSLOptions options)

      Like `updateSSLOptions(io.vertx.core.net.SSLOptions)` but supplying a handler that will be called when the update happened (or has failed).
      Parameters:
        `options` - the new SSL options
      Returns:

    - #### updateSSLOptions

          public Single<Boolean> updateSSLOptions(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).
      Parameters:
        `options` - the new SSL options
        `force` - force the update when options are equals
      Returns:

    - #### rxUpdateSSLOptions

          public Single<Boolean> rxUpdateSSLOptions(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).
      Parameters:
        `options` - the new SSL options
        `force` - force the update when options are equals
      Returns:

    - #### connectionHandler

          @Deprecated
          public HttpClient connectionHandler(Handler<HttpConnection> handler)

      Deprecated.
      Set a connection handler for the client. This handler is called when a new connection is established.
      Parameters:
        `handler` -
      Returns:
        a reference to this, so the API can be used fluently

    - #### redirectHandler

          @Deprecated
          public HttpClient redirectHandler(java.util.function.Function<HttpClientResponse,Single<RequestOptions>> handler)

      Deprecated.
      Set a redirect handler for the http client.

      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`.

      - when null is returned, the original response is processed by the original request response handler
      - when a new `Future` is returned, the client will send this new request
      The new request will get a copy of the previous request headers unless headers are set. In this case, the client assumes that the redirect handler exclusively managers the headers of the new request.

      The handler must return a `Future` unsent so the client can further configure it and send it.

      Parameters:
        `handler` - the new redirect handler
      Returns:
        a reference to this, so the API can be used fluently

    - #### close

          public Completable close()

      Close the client. Closing will close down any pooled connections. Clients should always be closed after use.
      Returns:

    - #### rxClose

          public Completable rxClose()

      Close the client. Closing will close down any pooled connections. Clients should always be closed after use.
      Returns:

    - #### newInstance

          public static HttpClient newInstance(HttpClient arg)

Copyright © 2024 Eclipse. All rights reserved.