类 DefaultWebClientBuilder
- 所有已实现的接口:
WebClient.Builder
WebClient.Builder.- 从以下版本开始:
- 4.0
- 作者:
- Rossen Stoyanchev, Brian Clozel
-
字段概要
字段修饰符和类型字段说明private Stringprivate ClientHttpConnectorprivate HttpHeadersprivate Consumer<WebClient.RequestHeadersSpec<?>>private ExchangeFunctionprivate List<ExchangeFilterFunction>private static final booleanprivate static final booleanprivate static final booleanprivate Map<Predicate<HttpStatusCode>,Function<ClientResponse, reactor.core.publisher.Mono<? extends Throwable>>> private ExchangeStrategiesprivate List<Consumer<ExchangeStrategies.Builder>>private UriBuilderFactory -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明apply(Consumer<WebClient.Builder> builderConsumer) Apply the givenConsumerto this builder instance.Configure a base URL for requests.build()Builder theWebClientinstance.clientConnector(ClientHttpConnector connector) Configure theClientHttpConnectorto use.clone()Clone thisWebClient.Builder.codecs(Consumer<ClientCodecConfigurer> configurer) private HttpHeadersdefaultCookie(String cookie, String... values) Global option to specify a cookie to be added to every request, if the request does not already contain such a cookie.defaultCookies(Consumer<cn.taketoday.util.MultiValueMap<String, String>> cookiesConsumer) Provides access to everyWebClient.Builder.defaultCookie(String, String...)declared so far with the possibility to add, replace, or remove.defaultHeader(String header, String... values) Global option to specify a header to be added to every request, if the request does not already contain such a header.defaultHeaders(Consumer<HttpHeaders> headersConsumer) Provides access to everyWebClient.Builder.defaultHeader(String, String...)declared so far with the possibility to add, replace, or remove.defaultRequest(Consumer<WebClient.RequestHeadersSpec<?>> defaultRequest) Provide a consumer to customize every request being built.defaultStatusHandler(Predicate<HttpStatusCode> statusPredicate, Function<ClientResponse, reactor.core.publisher.Mono<? extends Throwable>> exceptionFunction) Register a defaultstatus handlerto apply to every response.defaultUriVariables(Map<String, ?> defaultUriVariables) Configure default URL variable values to use when expanding URI templates with aMap.private voiddoCopyMultiValueMap(cn.taketoday.util.MultiValueMap<String, String> source, cn.taketoday.util.MultiValueMap<String, String> copy) exchangeFunction(ExchangeFunction exchangeFunction) exchangeStrategies(ExchangeStrategies strategies) Configure theExchangeStrategiesto use.exchangeStrategies(Consumer<ExchangeStrategies.Builder> configurer) Customize the strategies configured viaWebClient.Builder.exchangeStrategies(ExchangeStrategies).filter(ExchangeFilterFunction filter) Add the given filter to the end of the filter chain.private ExchangeFunctionfilterExchangeFunction(ExchangeFunction exchange) filters(Consumer<List<ExchangeFilterFunction>> filtersConsumer) Manipulate the filters with the given consumer.private ExchangeStrategies.Builderprivate ClientHttpConnectorprivate ExchangeStrategiesprivate List<ExchangeFilterFunction>private HttpHeadersprivate UriBuilderFactoryuriBuilderFactory(UriBuilderFactory uriBuilderFactory) Provide a pre-configuredUriBuilderFactoryinstance.
-
字段详细资料
-
reactorClientPresent
private static final boolean reactorClientPresent -
jettyClientPresent
private static final boolean jettyClientPresent -
httpComponentsClientPresent
private static final boolean httpComponentsClientPresent -
baseUrl
-
defaultUriVariables
-
uriBuilderFactory
-
defaultHeaders
-
defaultCookies
-
defaultRequest
-
statusHandlers
@Nullable private Map<Predicate<HttpStatusCode>,Function<ClientResponse, statusHandlersreactor.core.publisher.Mono<? extends Throwable>>> -
filters
-
connector
-
strategies
-
strategiesConfigurers
-
exchangeFunction
-
-
构造器详细资料
-
DefaultWebClientBuilder
public DefaultWebClientBuilder() -
DefaultWebClientBuilder
-
-
方法详细资料
-
baseUrl
从接口复制的说明:WebClient.BuilderConfigure a base URL for requests. Effectively a shortcut for:String baseUrl = "https://abc.go.com/v1"; DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory(baseUrl); WebClient client = WebClient.builder().uriBuilderFactory(factory).build();
The
DefaultUriBuilderFactoryis used to prepare the URL for every request with the given base URL, unless the URL request for a given URL is absolute in which case the base URL is ignored.Note: this method is mutually exclusive with
WebClient.Builder.uriBuilderFactory(UriBuilderFactory). If both are used, the baseUrl value provided here will be ignored. -
defaultUriVariables
从接口复制的说明:WebClient.BuilderConfigure default URL variable values to use when expanding URI templates with aMap. Effectively a shortcut for:Map<String, ?> defaultVars = ...; DefaultUriBuilderFactory factory = new DefaultUriBuilderFactory(); factory.setDefaultVariables(defaultVars); WebClient client = WebClient.builder().uriBuilderFactory(factory).build();
Note: this method is mutually exclusive with
WebClient.Builder.uriBuilderFactory(UriBuilderFactory). If both are used, the defaultUriVariables value provided here will be ignored. -
uriBuilderFactory
从接口复制的说明:WebClient.BuilderProvide a pre-configuredUriBuilderFactoryinstance. This is an alternative to, and effectively overrides the following shortcut properties:- 指定者:
uriBuilderFactory在接口中WebClient.Builder- 参数:
uriBuilderFactory- the URI builder factory to use- 另请参阅:
-
defaultHeader
从接口复制的说明:WebClient.BuilderGlobal option to specify a header to be added to every request, if the request does not already contain such a header.- 指定者:
defaultHeader在接口中WebClient.Builder- 参数:
header- the header namevalues- the header values
-
defaultHeaders
从接口复制的说明:WebClient.BuilderProvides access to everyWebClient.Builder.defaultHeader(String, String...)declared so far with the possibility to add, replace, or remove.- 指定者:
defaultHeaders在接口中WebClient.Builder- 参数:
headersConsumer- the consumer
-
initHeaders
-
defaultCookie
从接口复制的说明:WebClient.BuilderGlobal option to specify a cookie to be added to every request, if the request does not already contain such a cookie.- 指定者:
defaultCookie在接口中WebClient.Builder- 参数:
cookie- the cookie namevalues- the cookie values
-
defaultCookies
public WebClient.Builder defaultCookies(Consumer<cn.taketoday.util.MultiValueMap<String, String>> cookiesConsumer) 从接口复制的说明:WebClient.BuilderProvides access to everyWebClient.Builder.defaultCookie(String, String...)declared so far with the possibility to add, replace, or remove.- 指定者:
defaultCookies在接口中WebClient.Builder- 参数:
cookiesConsumer- a function that consumes the cookies map
-
initCookies
-
defaultRequest
从接口复制的说明:WebClient.BuilderProvide a consumer to customize every request being built.- 指定者:
defaultRequest在接口中WebClient.Builder- 参数:
defaultRequest- the consumer to use for modifying requests
-
defaultStatusHandler
public WebClient.Builder defaultStatusHandler(Predicate<HttpStatusCode> statusPredicate, Function<ClientResponse, reactor.core.publisher.Mono<? extends Throwable>> exceptionFunction) 从接口复制的说明:WebClient.BuilderRegister a defaultstatus handlerto apply to every response. Such default handlers are applied in the order in which they are registered, and after any others that are registered for a specific response.- 指定者:
defaultStatusHandler在接口中WebClient.Builder- 参数:
statusPredicate- to match responses withexceptionFunction- to map the response to an error signal- 返回:
- this builder
-
filter
从接口复制的说明:WebClient.BuilderAdd the given filter to the end of the filter chain.- 指定者:
filter在接口中WebClient.Builder- 参数:
filter- the filter to be added to the chain
-
filters
从接口复制的说明:WebClient.BuilderManipulate the filters with the given consumer. The list provided to the consumer is "live", so that the consumer can be used to remove filters, change ordering, etc.- 指定者:
filters在接口中WebClient.Builder- 参数:
filtersConsumer- a function that consumes the filter list- 返回:
- this builder
-
initFilters
-
clientConnector
从接口复制的说明:WebClient.BuilderConfigure theClientHttpConnectorto use. This is useful for plugging in and/or customizing options of the underlying HTTP client library (e.g. SSL).By default this is set to
ReactorClientHttpConnector.- 指定者:
clientConnector在接口中WebClient.Builder- 参数:
connector- the connector to use
-
codecs
从接口复制的说明:WebClient.Builder- 指定者:
codecs在接口中WebClient.Builder- 参数:
configurer- the configurer to apply
-
exchangeStrategies
从接口复制的说明:WebClient.BuilderConfigure theExchangeStrategiesto use.For most cases, prefer using
WebClient.Builder.codecs(Consumer)which allows customizing the codecs in theExchangeStrategiesrather than replace them. That ensures multiple parties can contribute to codecs configuration.By default this is set to
ExchangeStrategies.withDefaults().- 指定者:
exchangeStrategies在接口中WebClient.Builder- 参数:
strategies- the strategies to use
-
exchangeStrategies
从接口复制的说明:WebClient.BuilderCustomize the strategies configured viaWebClient.Builder.exchangeStrategies(ExchangeStrategies). This method is designed for use in scenarios where multiple parties wish to update theExchangeStrategies.- 指定者:
exchangeStrategies在接口中WebClient.Builder
-
exchangeFunction
从接口复制的说明:WebClient.BuilderProvide anExchangeFunctionpre-configured withClientHttpConnectorandExchangeStrategies.This is an alternative to, and effectively overrides
WebClient.Builder.clientConnector(cn.taketoday.http.client.reactive.ClientHttpConnector), andWebClient.Builder.exchangeStrategies(ExchangeStrategies).- 指定者:
exchangeFunction在接口中WebClient.Builder- 参数:
exchangeFunction- the exchange function to use
-
apply
从接口复制的说明:WebClient.BuilderApply the givenConsumerto this builder instance.This can be useful for applying pre-packaged customizations.
- 指定者:
apply在接口中WebClient.Builder- 参数:
builderConsumer- the consumer to apply
-
clone
从接口复制的说明:WebClient.BuilderClone thisWebClient.Builder.- 指定者:
clone在接口中WebClient.Builder- 覆盖:
clone在类中Object
-
build
从接口复制的说明:WebClient.BuilderBuilder theWebClientinstance.- 指定者:
build在接口中WebClient.Builder
-
filterExchangeFunction
-
initConnector
-
initExchangeStrategies
-
getOrCreateBuilder
-
initUriBuilderFactory
-
copyDefaultHeaders
-
copyDefaultCookies
-
doCopyMultiValueMap
-