@@ -101,20 +101,24 @@ public DefaultWebClientBuilder(DefaultWebClientBuilder other) {
101
101
this .defaultUriVariables = (other .defaultUriVariables != null ?
102
102
new LinkedHashMap <>(other .defaultUriVariables ) : null );
103
103
this .uriBuilderFactory = other .uriBuilderFactory ;
104
+
104
105
if (other .defaultHeaders != null ) {
105
106
this .defaultHeaders = new HttpHeaders ();
106
107
this .defaultHeaders .putAll (other .defaultHeaders );
107
108
}
108
109
else {
109
110
this .defaultHeaders = null ;
110
111
}
112
+
111
113
this .defaultCookies = (other .defaultCookies != null ?
112
114
new LinkedMultiValueMap <>(other .defaultCookies ) : null );
113
115
this .defaultRequest = other .defaultRequest ;
114
- this .filters = other .filters != null ? new ArrayList <>(other .filters ) : null ;
116
+ this .filters = (other .filters != null ? new ArrayList <>(other .filters ) : null );
117
+
115
118
this .connector = other .connector ;
116
119
this .strategies = other .strategies ;
117
- this .strategiesConfigurers = other .strategiesConfigurers != null ? new ArrayList <>(other .strategiesConfigurers ) : null ;
120
+ this .strategiesConfigurers = (other .strategiesConfigurers != null ?
121
+ new ArrayList <>(other .strategiesConfigurers ) : null );
118
122
this .exchangeFunction = other .exchangeFunction ;
119
123
}
120
124
@@ -260,8 +264,8 @@ public WebClient build() {
260
264
.map (filter -> filter .apply (exchange ))
261
265
.orElse (exchange ) : exchange );
262
266
return new DefaultWebClient (filteredExchange , initUriBuilderFactory (),
263
- this .defaultHeaders != null ? unmodifiableCopy (this .defaultHeaders ) : null ,
264
- this .defaultCookies != null ? unmodifiableCopy (this .defaultCookies ) : null ,
267
+ this .defaultHeaders != null ? HttpHeaders . readOnlyHttpHeaders (this .defaultHeaders ) : null ,
268
+ this .defaultCookies != null ? CollectionUtils . unmodifiableMultiValueMap (this .defaultCookies ) : null ,
265
269
this .defaultRequest , new DefaultWebClientBuilder (this ));
266
270
}
267
271
@@ -280,10 +284,10 @@ else if (jettyClientPresent) {
280
284
281
285
private ExchangeStrategies initExchangeStrategies () {
282
286
if (CollectionUtils .isEmpty (this .strategiesConfigurers )) {
283
- return this .strategies != null ? this .strategies : ExchangeStrategies .withDefaults ();
287
+ return ( this .strategies != null ? this .strategies : ExchangeStrategies .withDefaults () );
284
288
}
285
289
ExchangeStrategies .Builder builder =
286
- this .strategies != null ? this .strategies .mutate () : ExchangeStrategies .builder ();
290
+ ( this .strategies != null ? this .strategies .mutate () : ExchangeStrategies .builder () );
287
291
this .strategiesConfigurers .forEach (configurer -> configurer .accept (builder ));
288
292
return builder .build ();
289
293
}
@@ -292,18 +296,10 @@ private UriBuilderFactory initUriBuilderFactory() {
292
296
if (this .uriBuilderFactory != null ) {
293
297
return this .uriBuilderFactory ;
294
298
}
295
- DefaultUriBuilderFactory factory = this .baseUrl != null ?
296
- new DefaultUriBuilderFactory (this .baseUrl ) : new DefaultUriBuilderFactory ();
299
+ DefaultUriBuilderFactory factory = ( this .baseUrl != null ?
300
+ new DefaultUriBuilderFactory (this .baseUrl ) : new DefaultUriBuilderFactory ()) ;
297
301
factory .setDefaultUriVariables (this .defaultUriVariables );
298
302
return factory ;
299
303
}
300
304
301
- private static HttpHeaders unmodifiableCopy (HttpHeaders headers ) {
302
- return HttpHeaders .readOnlyHttpHeaders (headers );
303
- }
304
-
305
- private static <K , V > MultiValueMap <K , V > unmodifiableCopy (MultiValueMap <K , V > map ) {
306
- return CollectionUtils .unmodifiableMultiValueMap (new LinkedMultiValueMap <>(map ));
307
- }
308
-
309
305
}
0 commit comments