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
Modifier and Type | Method and Description |
---|---|
org.springframework.web.reactive.function.client.WebClient |
build()
Build a new
WebClient . |
static WebClientBuilder |
builder()
Create a new
WebClientBuilder . |
protected org.springframework.web.reactive.function.client.WebClient.Builder |
createWebClientBuilder()
Create the
WebClient.Builder to use. |
WebClientBuilder |
customizers(WebClientCustomizer... customizer)
Add the
WebClientCustomizers that should be applied to
the WebClient . |
WebClientBuilder |
defaultHeader(String name,
String value)
Add a default header that will be set if not already present on the outgoing
HttpRequest . |
WebClientBuilder |
endpoint(VaultEndpoint endpoint)
Set the
VaultEndpoint that should be used with the WebClient . |
WebClientBuilder |
endpointProvider(ReactiveVaultEndpointProvider provider)
Set the
ReactiveVaultEndpointProvider that should be used with the
WebClient . |
WebClientBuilder |
endpointProvider(VaultEndpointProvider provider)
Set the
VaultEndpointProvider that should be used with the
WebClient . |
WebClientBuilder |
filter(org.springframework.web.reactive.function.client.ExchangeFilterFunction... filterFunctions)
Add the
ExchangeFilterFunctions that should be
applied to the ClientRequest . |
WebClientBuilder |
httpConnector(org.springframework.http.client.reactive.ClientHttpConnector httpConnector)
Set the
ClientHttpConnector that should be used with the WebClient . |
WebClientBuilder |
httpConnectorFactory(Supplier<org.springframework.http.client.reactive.ClientHttpConnector> httpConnector)
|
WebClientBuilder |
requestFactory(Supplier<org.springframework.http.client.reactive.ClientHttpConnector> httpConnector)
Deprecated.
since 2.2.1 as the name is wrong, use
httpConnectorFactory(Supplier) |
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(org.springframework.http.client.reactive.ClientHttpConnector httpConnector)
ClientHttpConnector
that should be used with the WebClient
.httpConnector
- the HTTP connector.this
WebClientBuilder
.public WebClientBuilder httpConnectorFactory(Supplier<org.springframework.http.client.reactive.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<org.springframework.http.client.reactive.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(org.springframework.web.reactive.function.client.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 org.springframework.web.reactive.function.client.WebClient build()
WebClient
. VaultEndpoint
must be set.
Applies also ExchangeFilterFunction
and WebClientCustomizer
if
configured.WebClient
.protected org.springframework.web.reactive.function.client.WebClient.Builder createWebClientBuilder()
WebClient.Builder
to use.WebClient.Builder
to use.Copyright © 2016–2024 Pivotal Software, Inc.. All rights reserved.