Package io.vertx.core.http
Interface HttpClientBuilder
-
public interface HttpClientBuilderA builder forHttpClient.- Author:
- Julien Viet
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description HttpClientAgentbuild()Build and return the client.HttpClientBuilderwith(HttpClientOptions options)Configure the client options.HttpClientBuilderwith(PoolOptions options)Configure the client with the given pooloptions.HttpClientBuilderwithAddressResolver(AddressResolver<?> resolver)Configure the client to use a specific address resolver.HttpClientBuilderwithConnectHandler(Handler<HttpConnection> handler)Set a connection handler for the client.HttpClientBuilderwithLoadBalancer(LoadBalancer loadBalancer)Configure the client to use a load balancer.HttpClientBuilderwithRedirectHandler(Function<HttpClientResponse,Future<RequestOptions>> handler)Set a redirect handler for the http client.
-
-
-
Method Detail
-
with
HttpClientBuilder with(HttpClientOptions options)
Configure the client options.- Parameters:
options- the client options- Returns:
- a reference to this, so the API can be used fluently
-
with
HttpClientBuilder with(PoolOptions options)
Configure the client with the given pooloptions.- Parameters:
options- the pool 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
HttpClientBuilder withRedirectHandler(Function<HttpClientResponse,Future<RequestOptions>> handler)
Set a redirect handler for the http client.The redirect handler is called when a
3xxresponse is received and the request is configured to follow redirects withHttpClientRequest.setFollowRedirects(boolean).The redirect handler is passed the
HttpClientResponse, it can return anHttpClientRequestornull.- 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 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
HttpClientAgent build()
Build and return the client.- Returns:
- the client as configured by this builder
-
-