Package io.vertx.core.http

## Interface HttpClientAgent

- All Superinterfaces:
    `HttpClient`, `Measured`

      public interface HttpClientAgent
      extends HttpClient, Measured

  An asynchronous HTTP client.

  It allows you to make requests to HTTP servers, and a single client can make requests to any server.

  The client can also pool HTTP connections.

  For pooling to occur, keep-alive must be true on the `HttpClientOptions` (default is true). In this case connections will be pooled and re-used if there are pending HTTP requests waiting to get a connection, otherwise they will be closed.

  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 also supports pipe-lining of requests. Pipe-lining means another request is sent on the same connection before the response from the preceding one has returned. Pipe-lining is not appropriate for all requests.

  To enable pipe-lining, it must be enabled on the `HttpClientOptions` (default is false).

  When pipe-lining is enabled the connection will be automatically closed when all in-flight responses have returned and there are no outstanding pending requests to write.

  The client is designed to be reused between requests.

  Author:
    Julien Viet

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.util.function.Function<HttpClientResponse,​Future<RequestOptions>>` | `DEFAULT_REDIRECT_HANDLER` | Constant containing the default redirect handler of used by the client.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Future<HttpClientConnection>` | `connect​(HttpConnectOptions options)` | Connect to a remote HTTP server with the specific `options`, the connection is un-pooled and the management of the connection is left to the user.
    `default Future<Boolean>` | `updateSSLOptions​(ClientSSLOptions 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​(ClientSSLOptions 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.

    - ### Methods inherited from interface io.vertx.core.http.HttpClient

      `close, request, request, request, request, request, shutdown, shutdown`

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

      `isMetricsEnabled`

- - ### Field Detail

    - #### DEFAULT_REDIRECT_HANDLER

          static final java.util.function.Function<HttpClientResponse,​Future<RequestOptions>> DEFAULT_REDIRECT_HANDLER

      Constant containing the default redirect handler of used by the client. This is useful for building redirect handlers that need to delegate to the default behavior.

  - ### Method Detail

    - #### updateSSLOptions

          default Future<Boolean> updateSSLOptions​(ClientSSLOptions 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.

      Parameters:
        `options` - the new SSL options
      Returns:
        a future signaling the update success

    - #### updateSSLOptions

          Future<Boolean> updateSSLOptions​(ClientSSLOptions 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.

      Parameters:
        `options` - the new SSL options
        `force` - force the update when options are equals
      Returns:
        a future signaling the update success

    - #### connect

          Future<HttpClientConnection> connect​(HttpConnectOptions options)

      Connect to a remote HTTP server with the specific `options`, the connection is un-pooled and the management of the connection is left to the user.
      Parameters:
        `options` - the server connect options
      Returns:
        a future notified when the connection is available