Browse Source

Polishing

pull/1820/head
Juergen Hoeller 8 years ago
parent
commit
48807be482
  1. 17
      spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClientBuilder.java
  2. 6
      spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeStrategies.java
  3. 20
      spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java
  4. 6
      spring-webflux/src/main/java/org/springframework/web/reactive/function/server/HandlerStrategies.java
  5. 5
      spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerResponse.java

17
spring-webflux/src/main/java/org/springframework/web/reactive/function/client/DefaultWebClientBuilder.java

@ -63,11 +63,11 @@ final class DefaultWebClientBuilder implements WebClient.Builder { @@ -63,11 +63,11 @@ final class DefaultWebClientBuilder implements WebClient.Builder {
@Nullable
private ClientHttpConnector connector;
private ExchangeStrategies exchangeStrategies;
@Nullable
private ExchangeFunction exchangeFunction;
private ExchangeStrategies exchangeStrategies;
public DefaultWebClientBuilder() {
this.exchangeStrategies = ExchangeStrategies.withDefaults();
@ -91,8 +91,8 @@ final class DefaultWebClientBuilder implements WebClient.Builder { @@ -91,8 +91,8 @@ final class DefaultWebClientBuilder implements WebClient.Builder {
new LinkedMultiValueMap<>(other.defaultCookies) : null);
this.filters = (other.filters != null ? new ArrayList<>(other.filters) : null);
this.connector = other.connector;
this.exchangeStrategies = other.exchangeStrategies;
this.exchangeFunction = other.exchangeFunction;
this.exchangeStrategies = other.exchangeStrategies;
}
@ -182,15 +182,15 @@ final class DefaultWebClientBuilder implements WebClient.Builder { @@ -182,15 +182,15 @@ final class DefaultWebClientBuilder implements WebClient.Builder {
}
@Override
public WebClient.Builder exchangeStrategies(ExchangeStrategies strategies) {
Assert.notNull(strategies, "ExchangeStrategies must not be null");
this.exchangeStrategies = strategies;
public WebClient.Builder exchangeFunction(ExchangeFunction exchangeFunction) {
this.exchangeFunction = exchangeFunction;
return this;
}
@Override
public WebClient.Builder exchangeFunction(ExchangeFunction exchangeFunction) {
this.exchangeFunction = exchangeFunction;
public WebClient.Builder exchangeStrategies(ExchangeStrategies strategies) {
Assert.notNull(strategies, "ExchangeStrategies must not be null");
this.exchangeStrategies = strategies;
return this;
}
@ -242,7 +242,6 @@ final class DefaultWebClientBuilder implements WebClient.Builder { @@ -242,7 +242,6 @@ final class DefaultWebClientBuilder implements WebClient.Builder {
else if (this.connector != null) {
return ExchangeFunctions.create(this.connector, this.exchangeStrategies);
}
else {
return ExchangeFunctions.create(new ReactorClientHttpConnector(), this.exchangeStrategies);
}

6
spring-webflux/src/main/java/org/springframework/web/reactive/function/client/ExchangeStrategies.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -35,8 +35,6 @@ import org.springframework.http.codec.HttpMessageWriter; @@ -35,8 +35,6 @@ import org.springframework.http.codec.HttpMessageWriter;
*/
public interface ExchangeStrategies {
// Instance methods
/**
* Return the {@link HttpMessageReader}s to be used for request body conversion.
* @return the stream of message readers
@ -60,8 +58,6 @@ public interface ExchangeStrategies { @@ -60,8 +58,6 @@ public interface ExchangeStrategies {
return builder().build();
}
// Builder methods
/**
* Return a mutable builder for a {@code ExchangeStrategies} with default initialization.
* @return the builder

20
spring-webflux/src/main/java/org/springframework/web/reactive/function/client/WebClient.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -285,15 +285,6 @@ public interface WebClient { @@ -285,15 +285,6 @@ public interface WebClient {
*/
Builder filters(Consumer<List<ExchangeFilterFunction>> filtersConsumer);
/**
* Configure the {@link ExchangeStrategies} to use.
* <p>By default {@link ExchangeStrategies#withDefaults()} is used.
* @param strategies the strategies to use
* @see #clientConnector(ClientHttpConnector)
* @see #exchangeFunction(ExchangeFunction)
*/
Builder exchangeStrategies(ExchangeStrategies strategies);
/**
* Provide a pre-configured {@link ExchangeFunction} instance. This is
* an alternative to and effectively overrides the following:
@ -307,6 +298,15 @@ public interface WebClient { @@ -307,6 +298,15 @@ public interface WebClient {
*/
Builder exchangeFunction(ExchangeFunction exchangeFunction);
/**
* Configure the {@link ExchangeStrategies} to use.
* <p>By default {@link ExchangeStrategies#withDefaults()} is used.
* @param strategies the strategies to use
* @see #clientConnector(ClientHttpConnector)
* @see #exchangeFunction(ExchangeFunction)
*/
Builder exchangeStrategies(ExchangeStrategies strategies);
/**
* Clone this {@code WebClient.Builder}
*/

6
spring-webflux/src/main/java/org/springframework/web/reactive/function/server/HandlerStrategies.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2017 the original author or authors.
* Copyright 2002-2018 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -41,8 +41,6 @@ import org.springframework.web.server.i18n.LocaleContextResolver; @@ -41,8 +41,6 @@ import org.springframework.web.server.i18n.LocaleContextResolver;
*/
public interface HandlerStrategies {
// Instance methods
/**
* Return the {@link HttpMessageReader}s to be used for request body conversion.
* @return the message readers
@ -90,8 +88,6 @@ public interface HandlerStrategies { @@ -90,8 +88,6 @@ public interface HandlerStrategies {
return builder().build();
}
// Builder methods
/**
* Return a mutable builder for a {@code HandlerStrategies} with default initialization.
* @return the builder

5
spring-webflux/src/main/java/org/springframework/web/reactive/function/server/ServerResponse.java

@ -56,8 +56,6 @@ import org.springframework.web.server.ServerWebExchange; @@ -56,8 +56,6 @@ import org.springframework.web.server.ServerWebExchange;
*/
public interface ServerResponse {
// Instance methods
/**
* Return the status code of this response.
*/
@ -82,7 +80,7 @@ public interface ServerResponse { @@ -82,7 +80,7 @@ public interface ServerResponse {
Mono<Void> writeTo(ServerWebExchange exchange, Context context);
// Static builder methods
// Static methods
/**
* Create a builder with the status code and headers of the given response.
@ -190,7 +188,6 @@ public interface ServerResponse { @@ -190,7 +188,6 @@ public interface ServerResponse {
/**
* Create a builder with a {@linkplain HttpStatus#NOT_FOUND 404 Not Found} status.
*
* @return the created builder
*/
static HeadersBuilder<?> notFound() {

Loading…
Cancel
Save