1
1
/*
2
- * Copyright 2002-2018 the original author or authors.
2
+ * Copyright 2002-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -66,11 +66,11 @@ final class DefaultWebClientBuilder implements WebClient.Builder {
66
66
@ Nullable
67
67
private ClientHttpConnector connector ;
68
68
69
+ private ExchangeStrategies exchangeStrategies ;
70
+
69
71
@ Nullable
70
72
private ExchangeFunction exchangeFunction ;
71
73
72
- private ExchangeStrategies exchangeStrategies ;
73
-
74
74
75
75
public DefaultWebClientBuilder () {
76
76
this .exchangeStrategies = ExchangeStrategies .withDefaults ();
@@ -80,8 +80,8 @@ public DefaultWebClientBuilder(DefaultWebClientBuilder other) {
80
80
Assert .notNull (other , "DefaultWebClientBuilder must not be null" );
81
81
82
82
this .baseUrl = other .baseUrl ;
83
- this .defaultUriVariables =
84
- other . defaultUriVariables != null ? new LinkedHashMap <>(other .defaultUriVariables ) : null ;
83
+ this .defaultUriVariables = ( other . defaultUriVariables != null ?
84
+ new LinkedHashMap <>(other .defaultUriVariables ) : null ) ;
85
85
this .uriBuilderFactory = other .uriBuilderFactory ;
86
86
if (other .defaultHeaders != null ) {
87
87
this .defaultHeaders = new HttpHeaders ();
@@ -90,13 +90,13 @@ public DefaultWebClientBuilder(DefaultWebClientBuilder other) {
90
90
else {
91
91
this .defaultHeaders = null ;
92
92
}
93
- this .defaultCookies =
94
- other . defaultCookies != null ? new LinkedMultiValueMap <>(other .defaultCookies ) : null ;
93
+ this .defaultCookies = ( other . defaultCookies != null ?
94
+ new LinkedMultiValueMap <>(other .defaultCookies ) : null ) ;
95
95
this .defaultRequest = other .defaultRequest ;
96
96
this .filters = other .filters != null ? new ArrayList <>(other .filters ) : null ;
97
97
this .connector = other .connector ;
98
- this .exchangeFunction = other .exchangeFunction ;
99
98
this .exchangeStrategies = other .exchangeStrategies ;
99
+ this .exchangeFunction = other .exchangeFunction ;
100
100
}
101
101
102
102
@@ -163,12 +163,6 @@ public WebClient.Builder defaultRequest(Consumer<WebClient.RequestHeadersSpec<?>
163
163
return this ;
164
164
}
165
165
166
- @ Override
167
- public WebClient .Builder clientConnector (ClientHttpConnector connector ) {
168
- this .connector = connector ;
169
- return this ;
170
- }
171
-
172
166
@ Override
173
167
public WebClient .Builder filter (ExchangeFilterFunction filter ) {
174
168
Assert .notNull (filter , "ExchangeFilterFunction must not be null" );
@@ -190,8 +184,8 @@ private List<ExchangeFilterFunction> initFilters() {
190
184
}
191
185
192
186
@ Override
193
- public WebClient .Builder exchangeFunction ( ExchangeFunction exchangeFunction ) {
194
- this .exchangeFunction = exchangeFunction ;
187
+ public WebClient .Builder clientConnector ( ClientHttpConnector connector ) {
188
+ this .connector = connector ;
195
189
return this ;
196
190
}
197
191
@@ -202,6 +196,23 @@ public WebClient.Builder exchangeStrategies(ExchangeStrategies strategies) {
202
196
return this ;
203
197
}
204
198
199
+ @ Override
200
+ public WebClient .Builder exchangeFunction (ExchangeFunction exchangeFunction ) {
201
+ this .exchangeFunction = exchangeFunction ;
202
+ return this ;
203
+ }
204
+
205
+ @ Override
206
+ public WebClient .Builder apply (Consumer <WebClient .Builder > builderConsumer ) {
207
+ builderConsumer .accept (this );
208
+ return this ;
209
+ }
210
+
211
+ @ Override
212
+ public WebClient .Builder clone () {
213
+ return new DefaultWebClientBuilder (this );
214
+ }
215
+
205
216
@ Override
206
217
public WebClient build () {
207
218
ExchangeFunction exchange = initExchangeFunction ();
@@ -245,15 +256,4 @@ private static <K, V> MultiValueMap<K, V> unmodifiableCopy(MultiValueMap<K, V> m
245
256
return CollectionUtils .unmodifiableMultiValueMap (new LinkedMultiValueMap <>(map ));
246
257
}
247
258
248
- @ Override
249
- public WebClient .Builder clone () {
250
- return new DefaultWebClientBuilder (this );
251
- }
252
-
253
- @ Override
254
- public WebClient .Builder apply (Consumer <WebClient .Builder > builderConsumer ) {
255
- builderConsumer .accept (this );
256
- return this ;
257
- }
258
-
259
259
}
0 commit comments