From 560a504a83cd72b3f3283810a6664040fc905215 Mon Sep 17 00:00:00 2001 From: Rossen Stoyanchev Date: Mon, 9 Nov 2020 22:07:15 +0000 Subject: [PATCH] Polishing in DefaultWebClient --- .../function/client/DefaultWebClient.java | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java index 08ccf3548b..a0ef3237fe 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClient.java @@ -185,6 +185,7 @@ class DefaultWebClient implements WebClient { this.httpMethod = httpMethod; } + @Override public RequestBodySpec uri(String uriTemplate, Object... uriVariables) { attribute(URI_TEMPLATE_ATTRIBUTE, uriTemplate); @@ -242,18 +243,6 @@ class DefaultWebClient implements WebClient { return this; } - @Override - public RequestBodySpec attribute(String name, Object value) { - this.attributes.put(name, value); - return this; - } - - @Override - public RequestBodySpec attributes(Consumer> attributesConsumer) { - attributesConsumer.accept(this.attributes); - return this; - } - @Override public DefaultRequestBodyUriSpec accept(MediaType... acceptableMediaTypes) { getHeaders().setAccept(Arrays.asList(acceptableMediaTypes)); @@ -302,6 +291,18 @@ class DefaultWebClient implements WebClient { return this; } + @Override + public RequestBodySpec attribute(String name, Object value) { + this.attributes.put(name, value); + return this; + } + + @Override + public RequestBodySpec attributes(Consumer> attributesConsumer) { + attributesConsumer.accept(this.attributes); + return this; + } + @Override public RequestBodySpec context(Function contextModifier) { this.contextModifier = (this.contextModifier != null ? @@ -497,12 +498,14 @@ class DefaultWebClient implements WebClient { private final List statusHandlers = new ArrayList<>(1); + DefaultResponseSpec(Mono responseMono, Supplier requestSupplier) { this.responseMono = responseMono; this.requestSupplier = requestSupplier; this.statusHandlers.add(DEFAULT_STATUS_HANDLER); } + @Override public ResponseSpec onStatus(Predicate statusPredicate, Function> exceptionFunction) {