class DefaultWebTestClientBuilder extends java.lang.Object implements WebTestClient.Builder
WebTestClient.Builder
.Modifier and Type | Field and Description |
---|---|
private ClientHttpConnector |
connector |
private WebHttpHandlerBuilder |
httpHandlerBuilder |
private java.time.Duration |
responseTimeout |
private WebClient.Builder |
webClientBuilder |
Constructor and Description |
---|
DefaultWebTestClientBuilder() |
DefaultWebTestClientBuilder(DefaultWebTestClientBuilder other) |
DefaultWebTestClientBuilder(WebClient.Builder webClientBuilder,
WebHttpHandlerBuilder httpHandlerBuilder,
ClientHttpConnector connector,
java.time.Duration responseTimeout) |
DefaultWebTestClientBuilder(WebHttpHandlerBuilder httpHandlerBuilder) |
Modifier and Type | Method and Description |
---|---|
WebTestClient.Builder |
apply(WebTestClientConfigurer configurer)
Shortcut for pre-packaged customizations to WebTestClient builder.
|
WebTestClient.Builder |
baseUrl(java.lang.String baseUrl)
Configure a base URI as described in
WebClient.create(String) . |
WebTestClient |
build()
Build the
WebTestClient instance. |
WebTestClient.Builder |
defaultCookie(java.lang.String cookieName,
java.lang.String... cookieValues)
Add the given header to all requests that haven't added it.
|
WebTestClient.Builder |
defaultCookies(java.util.function.Consumer<MultiValueMap<java.lang.String,java.lang.String>> cookiesConsumer)
Manipulate the default cookies with the given consumer.
|
WebTestClient.Builder |
defaultHeader(java.lang.String headerName,
java.lang.String... headerValues)
Add the given header to all requests that haven't added it.
|
WebTestClient.Builder |
defaultHeaders(java.util.function.Consumer<HttpHeaders> headersConsumer)
Manipulate the default headers with the given consumer.
|
WebTestClient.Builder |
exchangeStrategies(ExchangeStrategies strategies)
Configure the
ExchangeStrategies to use. |
WebTestClient.Builder |
filter(ExchangeFilterFunction filter)
Add the given filter to the filter chain.
|
WebTestClient.Builder |
filters(java.util.function.Consumer<java.util.List<ExchangeFilterFunction>> filtersConsumer)
Manipulate the filters with the given consumer.
|
WebTestClient.Builder |
responseTimeout(java.time.Duration timeout)
Max amount of time to wait for responses.
|
WebTestClient.Builder |
uriBuilderFactory(UriBuilderFactory uriBuilderFactory)
Provide a pre-configured
UriBuilderFactory instance as an
alternative to and effectively overriding WebTestClient.Builder.baseUrl(String) . |
private final WebClient.Builder webClientBuilder
@Nullable private final WebHttpHandlerBuilder httpHandlerBuilder
@Nullable private final ClientHttpConnector connector
@Nullable private java.time.Duration responseTimeout
DefaultWebTestClientBuilder()
DefaultWebTestClientBuilder(WebHttpHandlerBuilder httpHandlerBuilder)
DefaultWebTestClientBuilder(DefaultWebTestClientBuilder other)
DefaultWebTestClientBuilder(@Nullable WebClient.Builder webClientBuilder, @Nullable WebHttpHandlerBuilder httpHandlerBuilder, @Nullable ClientHttpConnector connector, @Nullable java.time.Duration responseTimeout)
public WebTestClient.Builder baseUrl(java.lang.String baseUrl)
WebTestClient.Builder
WebClient.create(String)
.baseUrl
in interface WebTestClient.Builder
public WebTestClient.Builder uriBuilderFactory(UriBuilderFactory uriBuilderFactory)
WebTestClient.Builder
UriBuilderFactory
instance as an
alternative to and effectively overriding WebTestClient.Builder.baseUrl(String)
.uriBuilderFactory
in interface WebTestClient.Builder
public WebTestClient.Builder defaultHeader(java.lang.String headerName, java.lang.String... headerValues)
WebTestClient.Builder
defaultHeader
in interface WebTestClient.Builder
headerName
- the header nameheaderValues
- the header valuespublic WebTestClient.Builder defaultHeaders(java.util.function.Consumer<HttpHeaders> headersConsumer)
WebTestClient.Builder
HttpHeaders
methods.defaultHeaders
in interface WebTestClient.Builder
headersConsumer
- a function that consumes the HttpHeaders
public WebTestClient.Builder defaultCookie(java.lang.String cookieName, java.lang.String... cookieValues)
WebTestClient.Builder
defaultCookie
in interface WebTestClient.Builder
cookieName
- the cookie namecookieValues
- the cookie valuespublic WebTestClient.Builder defaultCookies(java.util.function.Consumer<MultiValueMap<java.lang.String,java.lang.String>> cookiesConsumer)
WebTestClient.Builder
MultiValueMap
methods.defaultCookies
in interface WebTestClient.Builder
cookiesConsumer
- a function that consumes the cookies mappublic WebTestClient.Builder filter(ExchangeFilterFunction filter)
WebTestClient.Builder
filter
in interface WebTestClient.Builder
filter
- the filter to be added to the chainpublic WebTestClient.Builder filters(java.util.function.Consumer<java.util.List<ExchangeFilterFunction>> filtersConsumer)
WebTestClient.Builder
filters
in interface WebTestClient.Builder
filtersConsumer
- a function that consumes the filter listpublic WebTestClient.Builder exchangeStrategies(ExchangeStrategies strategies)
WebTestClient.Builder
ExchangeStrategies
to use.
By default ExchangeStrategies.withDefaults()
is used.
exchangeStrategies
in interface WebTestClient.Builder
strategies
- the strategies to usepublic WebTestClient.Builder responseTimeout(java.time.Duration timeout)
WebTestClient.Builder
By default 5 seconds.
responseTimeout
in interface WebTestClient.Builder
timeout
- the response timeout valuepublic WebTestClient.Builder apply(WebTestClientConfigurer configurer)
WebTestClient.Builder
apply
in interface WebTestClient.Builder
configurer
- the configurer to applypublic WebTestClient build()
WebTestClient.Builder
WebTestClient
instance.build
in interface WebTestClient.Builder