Interface HttpClientBuilder


public interface HttpClientBuilder
A builder for HttpClient.
Author:
Julien Viet
  • Method Details

    • with

      Configure the client options.
      Parameters:
      options - the client options
      Returns:
      a reference to this, so the API can be used fluently
    • with

      Configure the client.
      Parameters:
      config - the client config
      Returns:
      a reference to this, so the API can be used fluently
    • with

      Configure the client with the given pool options.
      Parameters:
      options - the pool options
      Returns:
      a reference to this, so the API can be used fluently
    • with

      Configure the client with the given SSL options.
      Parameters:
      options - the SSL options
      Returns:
      a reference to this, so the API can be used fluently
    • with

      Configure the client with the given SSL engine.
      Parameters:
      engine - the SSL engine options
      Returns:
      a reference to this, so the API can be used fluently
    • withConnectHandler

      HttpClientBuilder withConnectHandler(Handler<HttpConnection> handler)
      Set a connection handler for the client. This handler is called when a new connection is established.
      Returns:
      a reference to this, so the API can be used fluently
    • withRedirectHandler

      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<HttpClientRequest> 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<HttpClientRequest> 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
    • withAddressResolver

      HttpClientBuilder withAddressResolver(AddressResolver<?> resolver)
      Configure the client to use a specific address resolver.
      Parameters:
      resolver - the address resolver
    • withLoadBalancer

      HttpClientBuilder withLoadBalancer(LoadBalancer loadBalancer)
      Configure the client to use a load balancer.
      Parameters:
      loadBalancer - the load balancer
    • build

      Build and return the client.
      Returns:
      the client as configured by this builder