提交 48807be4 编写于 作者: J Juergen Hoeller

Polishing

上级 c9f48836
......@@ -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 {
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 {
}
@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 {
else if (this.connector != null) {
return ExchangeFunctions.create(this.connector, this.exchangeStrategies);
}
else {
return ExchangeFunctions.create(new ReactorClientHttpConnector(), this.exchangeStrategies);
}
......
/*
* 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;
*/
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 {
return builder().build();
}
// Builder methods
/**
* Return a mutable builder for a {@code ExchangeStrategies} with default initialization.
* @return the builder
......
/*
* 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 {
*/
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 {
*/
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}
*/
......
/*
* 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;
*/
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 {
return builder().build();
}
// Builder methods
/**
* Return a mutable builder for a {@code HandlerStrategies} with default initialization.
* @return the builder
......
......@@ -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 {
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 {
/**
* Create a builder with a {@linkplain HttpStatus#NOT_FOUND 404 Not Found} status.
*
* @return the created builder
*/
static HeadersBuilder<?> notFound() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册