|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2018 the original author or authors. |
|
|
|
* Copyright 2002-2019 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -66,11 +66,11 @@ final class DefaultWebClientBuilder implements WebClient.Builder { |
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
private ClientHttpConnector connector; |
|
|
|
private ClientHttpConnector connector; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ExchangeStrategies exchangeStrategies; |
|
|
|
|
|
|
|
|
|
|
|
@Nullable |
|
|
|
@Nullable |
|
|
|
private ExchangeFunction exchangeFunction; |
|
|
|
private ExchangeFunction exchangeFunction; |
|
|
|
|
|
|
|
|
|
|
|
private ExchangeStrategies exchangeStrategies; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DefaultWebClientBuilder() { |
|
|
|
public DefaultWebClientBuilder() { |
|
|
|
this.exchangeStrategies = ExchangeStrategies.withDefaults(); |
|
|
|
this.exchangeStrategies = ExchangeStrategies.withDefaults(); |
|
|
|
@ -80,8 +80,8 @@ final class DefaultWebClientBuilder implements WebClient.Builder { |
|
|
|
Assert.notNull(other, "DefaultWebClientBuilder must not be null"); |
|
|
|
Assert.notNull(other, "DefaultWebClientBuilder must not be null"); |
|
|
|
|
|
|
|
|
|
|
|
this.baseUrl = other.baseUrl; |
|
|
|
this.baseUrl = other.baseUrl; |
|
|
|
this.defaultUriVariables = |
|
|
|
this.defaultUriVariables = (other.defaultUriVariables != null ? |
|
|
|
other.defaultUriVariables != null ? new LinkedHashMap<>(other.defaultUriVariables) : null; |
|
|
|
new LinkedHashMap<>(other.defaultUriVariables) : null); |
|
|
|
this.uriBuilderFactory = other.uriBuilderFactory; |
|
|
|
this.uriBuilderFactory = other.uriBuilderFactory; |
|
|
|
if (other.defaultHeaders != null) { |
|
|
|
if (other.defaultHeaders != null) { |
|
|
|
this.defaultHeaders = new HttpHeaders(); |
|
|
|
this.defaultHeaders = new HttpHeaders(); |
|
|
|
@ -90,13 +90,13 @@ final class DefaultWebClientBuilder implements WebClient.Builder { |
|
|
|
else { |
|
|
|
else { |
|
|
|
this.defaultHeaders = null; |
|
|
|
this.defaultHeaders = null; |
|
|
|
} |
|
|
|
} |
|
|
|
this.defaultCookies = |
|
|
|
this.defaultCookies = (other.defaultCookies != null ? |
|
|
|
other.defaultCookies != null ? new LinkedMultiValueMap<>(other.defaultCookies) : null; |
|
|
|
new LinkedMultiValueMap<>(other.defaultCookies) : null); |
|
|
|
this.defaultRequest = other.defaultRequest; |
|
|
|
this.defaultRequest = other.defaultRequest; |
|
|
|
this.filters = other.filters != null ? new ArrayList<>(other.filters) : null; |
|
|
|
this.filters = other.filters != null ? new ArrayList<>(other.filters) : null; |
|
|
|
this.connector = other.connector; |
|
|
|
this.connector = other.connector; |
|
|
|
this.exchangeFunction = other.exchangeFunction; |
|
|
|
|
|
|
|
this.exchangeStrategies = other.exchangeStrategies; |
|
|
|
this.exchangeStrategies = other.exchangeStrategies; |
|
|
|
|
|
|
|
this.exchangeFunction = other.exchangeFunction; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -163,12 +163,6 @@ final class DefaultWebClientBuilder implements WebClient.Builder { |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public WebClient.Builder clientConnector(ClientHttpConnector connector) { |
|
|
|
|
|
|
|
this.connector = connector; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public WebClient.Builder filter(ExchangeFilterFunction filter) { |
|
|
|
public WebClient.Builder filter(ExchangeFilterFunction filter) { |
|
|
|
Assert.notNull(filter, "ExchangeFilterFunction must not be null"); |
|
|
|
Assert.notNull(filter, "ExchangeFilterFunction must not be null"); |
|
|
|
@ -190,8 +184,8 @@ final class DefaultWebClientBuilder implements WebClient.Builder { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public WebClient.Builder exchangeFunction(ExchangeFunction exchangeFunction) { |
|
|
|
public WebClient.Builder clientConnector(ClientHttpConnector connector) { |
|
|
|
this.exchangeFunction = exchangeFunction; |
|
|
|
this.connector = connector; |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -202,6 +196,23 @@ final class DefaultWebClientBuilder implements WebClient.Builder { |
|
|
|
return this; |
|
|
|
return this; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public WebClient.Builder exchangeFunction(ExchangeFunction exchangeFunction) { |
|
|
|
|
|
|
|
this.exchangeFunction = exchangeFunction; |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public WebClient.Builder apply(Consumer<WebClient.Builder> builderConsumer) { |
|
|
|
|
|
|
|
builderConsumer.accept(this); |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public WebClient.Builder clone() { |
|
|
|
|
|
|
|
return new DefaultWebClientBuilder(this); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public WebClient build() { |
|
|
|
public WebClient build() { |
|
|
|
ExchangeFunction exchange = initExchangeFunction(); |
|
|
|
ExchangeFunction exchange = initExchangeFunction(); |
|
|
|
@ -245,15 +256,4 @@ final class DefaultWebClientBuilder implements WebClient.Builder { |
|
|
|
return CollectionUtils.unmodifiableMultiValueMap(new LinkedMultiValueMap<>(map)); |
|
|
|
return CollectionUtils.unmodifiableMultiValueMap(new LinkedMultiValueMap<>(map)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public WebClient.Builder clone() { |
|
|
|
|
|
|
|
return new DefaultWebClientBuilder(this); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public WebClient.Builder apply(Consumer<WebClient.Builder> builderConsumer) { |
|
|
|
|
|
|
|
builderConsumer.accept(this); |
|
|
|
|
|
|
|
return this; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|