public interface WebClientProvider
WebClients using a pre-configured scheme. This class returns WebClient for a
specific endpoint and encapsulates common configuration aspects of WebClient so
that code using WebClient is not required to apply further configuration to the actual client.
Client instances are typically cached allowing reuse of pooled connections if configured on the
ClientHttpConnector.static WebClientProvider http()
WebClientProvider.static WebClientProvider create(String scheme)
scheme - protocol scheme such as http or https.WebClientProvider.static WebClientProvider create(String scheme, @Nullable ClientHttpConnector connector)
scheme - protocol scheme such as http or https.connector - the HTTP connector to use. Can be null.WebClientProvider.WebClient get(InetSocketAddress endpoint)
WebClient configured with default HTTP headers and
Consumer error callback for a given endpoint.HttpHeaders getDefaultHeaders()
HttpHeaders to be used by default.HttpHeaders.EMPTY by default.Consumer<Throwable> getErrorListener()
error listener to be used;@Nullable String getPathPrefix()
pathPrefix to be used.WebClientProvider withDefaultHeaders(HttpHeaders headers)
WebClientProvider applying the given headers by default.headers - must not be null.WebClientProvider.WebClientProvider withErrorListener(Consumer<Throwable> errorListener)
WebClientProvider calling the given Consumer on error.errorListener - must not be null.WebClientProvider.WebClientProvider withPathPrefix(String pathPrefix)
WebClientProvider where HTTP requests are called with the given path prefix.pathPrefix - Path prefix to add to requestsWebClientProviderWebClientProvider withWebClientConfigurer(Function<WebClient,WebClient> webClientConfigurer)
webClientConfigurer - configuration functionWebClientProviderCopyright © 2011–2021 Pivotal Software, Inc.. All rights reserved.