public class WebClientBuilder extends Object
WebClient
. Provides
convenience methods to configure ClientHttpConnector
and default headers
.
By default the built WebClient
will attempt to use the most suitable
ClientHttpConnector
using ClientHttpConnectorFactory.create(org.springframework.vault.support.ClientOptions, org.springframework.vault.support.SslConfiguration)
.ClientHttpConnectorFactory
,
WebClientCustomizer
public static WebClientBuilder builder()
WebClientBuilder
.WebClientBuilder
.public WebClientBuilder endpoint(VaultEndpoint endpoint)
VaultEndpoint
that should be used with the WebClient
.endpoint
- the VaultEndpoint
provider.this
WebClientBuilder
.public WebClientBuilder endpointProvider(VaultEndpointProvider provider)
VaultEndpointProvider
that should be used with the
WebClient
. VaultEndpointProvider.getVaultEndpoint()
is called on
a dedicated Thread
to
ensure that I/O threads are never blocked.provider
- the VaultEndpoint
provider.this
WebClientBuilder
.public WebClientBuilder endpointProvider(ReactiveVaultEndpointProvider provider)
ReactiveVaultEndpointProvider
that should be used with the
WebClient
.provider
- the VaultEndpoint
provider.this
WebClientBuilder
.public WebClientBuilder httpConnector(ClientHttpConnector httpConnector)
ClientHttpConnector
that should be used with the WebClient
.httpConnector
- the HTTP connector.this
WebClientBuilder
.public WebClientBuilder httpConnectorFactory(Supplier<ClientHttpConnector> httpConnector)
Supplier
of ClientHttpConnector
that should be called each
time we build()
a new WebClient
instance.httpConnector
- the supplier for the HTTP connector.this
WebClientBuilder
.@Deprecated public WebClientBuilder requestFactory(Supplier<ClientHttpConnector> httpConnector)
httpConnectorFactory(Supplier)
Supplier
of ClientHttpConnector
that should be called each
time we build()
a new WebClient
instance.httpConnector
- the supplier for the HTTP connector.this
WebClientBuilder
.public WebClientBuilder defaultHeader(String name, String value)
HttpRequest
.name
- the name of the header.value
- the header value.this
WebClientBuilder
.public WebClientBuilder customizers(WebClientCustomizer... customizer)
WebClientCustomizers
that should be applied to
the WebClient
. Customizers are applied in the order that they were added.customizer
- the client customizers to add.this
WebClientBuilder
.public WebClientBuilder filter(ExchangeFilterFunction... filterFunctions)
ExchangeFilterFunctions
that should be
applied to the ClientRequest
. ExchangeFilterFunction
s are applied
in the order that they were added.filterFunctions
- the request customizers to add.this
WebClientBuilder
.public WebClient build()
WebClient
. VaultEndpoint
must be set.
Applies also ExchangeFilterFunction
and WebClientCustomizer
if
configured.WebClient
.protected WebClient.Builder createWebClientBuilder()
WebClient.Builder
to use.WebClient.Builder
to use.Copyright © 2016–2021 Pivotal Software, Inc.. All rights reserved.