Search in sources :

Example 16 with ClientHttpConnector

use of org.springframework.http.client.reactive.ClientHttpConnector in project spring-framework by spring-projects.

the class DefaultWebClientBuilder method build.

@Override
public WebClient build() {
    ClientHttpConnector connectorToUse = (this.connector != null ? this.connector : initConnector());
    ExchangeFunction exchange = (this.exchangeFunction == null ? ExchangeFunctions.create(connectorToUse, initExchangeStrategies()) : this.exchangeFunction);
    ExchangeFunction filteredExchange = (this.filters != null ? this.filters.stream().reduce(ExchangeFilterFunction::andThen).map(filter -> filter.apply(exchange)).orElse(exchange) : exchange);
    HttpHeaders defaultHeaders = copyDefaultHeaders();
    MultiValueMap<String, String> defaultCookies = copyDefaultCookies();
    return new DefaultWebClient(filteredExchange, initUriBuilderFactory(), defaultHeaders, defaultCookies, this.defaultRequest, new DefaultWebClientBuilder(this));
}
Also used : HttpComponentsClientHttpConnector(org.springframework.http.client.reactive.HttpComponentsClientHttpConnector) ReactorClientHttpConnector(org.springframework.http.client.reactive.ReactorClientHttpConnector) Arrays(java.util.Arrays) ClassUtils(org.springframework.util.ClassUtils) JettyClientHttpConnector(org.springframework.http.client.reactive.JettyClientHttpConnector) HttpHeaders(org.springframework.http.HttpHeaders) MultiValueMap(org.springframework.util.MultiValueMap) ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Consumer(java.util.function.Consumer) ClientCodecConfigurer(org.springframework.http.codec.ClientCodecConfigurer) List(java.util.List) CollectionUtils(org.springframework.util.CollectionUtils) Map(java.util.Map) DefaultUriBuilderFactory(org.springframework.web.util.DefaultUriBuilderFactory) UriBuilderFactory(org.springframework.web.util.UriBuilderFactory) Nullable(org.springframework.lang.Nullable) JdkClientHttpConnector(org.springframework.http.client.reactive.JdkClientHttpConnector) LinkedMultiValueMap(org.springframework.util.LinkedMultiValueMap) ClientHttpConnector(org.springframework.http.client.reactive.ClientHttpConnector) Assert(org.springframework.util.Assert) HttpHeaders(org.springframework.http.HttpHeaders) HttpComponentsClientHttpConnector(org.springframework.http.client.reactive.HttpComponentsClientHttpConnector) ReactorClientHttpConnector(org.springframework.http.client.reactive.ReactorClientHttpConnector) JettyClientHttpConnector(org.springframework.http.client.reactive.JettyClientHttpConnector) JdkClientHttpConnector(org.springframework.http.client.reactive.JdkClientHttpConnector) ClientHttpConnector(org.springframework.http.client.reactive.ClientHttpConnector)

Aggregations

ClientHttpConnector (org.springframework.http.client.reactive.ClientHttpConnector)16 WebClient (org.springframework.web.reactive.function.client.WebClient)10 Test (org.junit.Test)9 HttpHandlerConnector (org.springframework.test.web.reactive.server.HttpHandlerConnector)8 QueueChannel (org.springframework.integration.channel.QueueChannel)7 Matchers.containsString (org.hamcrest.Matchers.containsString)6 ClientHttpResponse (org.springframework.http.client.reactive.ClientHttpResponse)5 List (java.util.List)4 Assert.assertEquals (org.junit.Assert.assertEquals)3 Assert.assertNotNull (org.junit.Assert.assertNotNull)3 DataBuffer (org.springframework.core.io.buffer.DataBuffer)3 DataBufferFactory (org.springframework.core.io.buffer.DataBufferFactory)3 HttpHeaders (org.springframework.http.HttpHeaders)3 HttpStatus (org.springframework.http.HttpStatus)3 ReactorClientHttpConnector (org.springframework.http.client.reactive.ReactorClientHttpConnector)3 ErrorMessage (org.springframework.messaging.support.ErrorMessage)3 MockClientHttpResponse (org.springframework.mock.http.client.reactive.MockClientHttpResponse)3 ExchangeFunction (org.springframework.web.reactive.function.client.ExchangeFunction)3 ExchangeFunctions (org.springframework.web.reactive.function.client.ExchangeFunctions)3 Flux (reactor.core.publisher.Flux)3