Polishing
This commit is contained in:
parent
6a207d0012
commit
2861fc65bd
|
|
@ -52,9 +52,8 @@ abstract class ParserStrategyUtils {
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
static <T> T instantiateClass(Class<?> clazz, Class<T> assignableTo,
|
static <T> T instantiateClass(Class<?> clazz, Class<T> assignableTo, Environment environment,
|
||||||
Environment environment, ResourceLoader resourceLoader,
|
ResourceLoader resourceLoader, BeanDefinitionRegistry registry) {
|
||||||
BeanDefinitionRegistry registry) {
|
|
||||||
|
|
||||||
Assert.notNull(clazz, "Class must not be null");
|
Assert.notNull(clazz, "Class must not be null");
|
||||||
Assert.isAssignable(assignableTo, clazz);
|
Assert.isAssignable(assignableTo, clazz);
|
||||||
|
|
|
||||||
|
|
@ -358,7 +358,6 @@ public interface DataBuffer {
|
||||||
/**
|
/**
|
||||||
* Return this buffer's data a String using the specified charset. Default implementation
|
* Return this buffer's data a String using the specified charset. Default implementation
|
||||||
* delegates to {@code toString(readPosition(), readableByteCount(), charset)}.
|
* delegates to {@code toString(readPosition(), readableByteCount(), charset)}.
|
||||||
*
|
|
||||||
* @param charset the character set to use
|
* @param charset the character set to use
|
||||||
* @return a string representation of all this buffers data
|
* @return a string representation of all this buffers data
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
|
|
@ -370,7 +369,6 @@ public interface DataBuffer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a part of this buffer's data as a String using the specified charset.
|
* Return a part of this buffer's data as a String using the specified charset.
|
||||||
*
|
|
||||||
* @param index the index at which to start the string
|
* @param index the index at which to start the string
|
||||||
* @param length the number of bytes to use for the string
|
* @param length the number of bytes to use for the string
|
||||||
* @param charset the charset to use
|
* @param charset the charset to use
|
||||||
|
|
|
||||||
|
|
@ -164,8 +164,9 @@ public abstract class DataBufferUtils {
|
||||||
* @return a Flux of data buffers read from the given channel
|
* @return a Flux of data buffers read from the given channel
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
public static Flux<DataBuffer> read(Path path, DataBufferFactory bufferFactory, int bufferSize,
|
public static Flux<DataBuffer> read(
|
||||||
OpenOption... options) {
|
Path path, DataBufferFactory bufferFactory, int bufferSize, OpenOption... options) {
|
||||||
|
|
||||||
Assert.notNull(path, "Path must not be null");
|
Assert.notNull(path, "Path must not be null");
|
||||||
Assert.notNull(bufferFactory, "BufferFactory must not be null");
|
Assert.notNull(bufferFactory, "BufferFactory must not be null");
|
||||||
Assert.isTrue(bufferSize > 0, "'bufferSize' must be > 0");
|
Assert.isTrue(bufferSize > 0, "'bufferSize' must be > 0");
|
||||||
|
|
@ -538,8 +539,8 @@ public abstract class DataBufferUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return a {@link Matcher} for the given delimiter. The matcher can be used to find the
|
* Return a {@link Matcher} for the given delimiter.
|
||||||
* delimiters in data buffers.
|
* The matcher can be used to find the delimiters in data buffers.
|
||||||
* @param delimiter the delimiter bytes to find
|
* @param delimiter the delimiter bytes to find
|
||||||
* @return the matcher
|
* @return the matcher
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
|
|
@ -549,8 +550,8 @@ public abstract class DataBufferUtils {
|
||||||
return new KnuthMorrisPrattMatcher(delimiter);
|
return new KnuthMorrisPrattMatcher(delimiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return a {@link Matcher} for the given delimiters. The matcher can be used to find the
|
/** Return a {@link Matcher} for the given delimiters.
|
||||||
* delimiters in data buffers.
|
* The matcher can be used to find the delimiters in data buffers.
|
||||||
* @param delimiters the delimiters bytes to find
|
* @param delimiters the delimiters bytes to find
|
||||||
* @return the matcher
|
* @return the matcher
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
|
|
@ -595,7 +596,6 @@ public abstract class DataBufferUtils {
|
||||||
* Resets the state of this matcher.
|
* Resets the state of this matcher.
|
||||||
*/
|
*/
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -730,7 +730,6 @@ public abstract class DataBufferUtils {
|
||||||
private boolean isNotDisposed() {
|
private boolean isNotDisposed() {
|
||||||
return !this.disposed.get();
|
return !this.disposed.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -866,12 +865,11 @@ public abstract class DataBufferUtils {
|
||||||
this.sink.next(dataBuffer);
|
this.sink.next(dataBuffer);
|
||||||
this.dataBuffer.set(null);
|
this.dataBuffer.set(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of {@link Matcher} that uses the Knuth-Morris-Pratt algorithm.
|
* Implementation of {@link Matcher} that uses the Knuth-Morris-Pratt algorithm.
|
||||||
*
|
|
||||||
* @see <a href="https://www.nayuki.io/page/knuth-morris-pratt-string-matching">Knuth-Morris-Pratt string matching</a>
|
* @see <a href="https://www.nayuki.io/page/knuth-morris-pratt-string-matching">Knuth-Morris-Pratt string matching</a>
|
||||||
*/
|
*/
|
||||||
private static class KnuthMorrisPrattMatcher implements Matcher {
|
private static class KnuthMorrisPrattMatcher implements Matcher {
|
||||||
|
|
@ -882,7 +880,6 @@ public abstract class DataBufferUtils {
|
||||||
|
|
||||||
private int matches = 0;
|
private int matches = 0;
|
||||||
|
|
||||||
|
|
||||||
public KnuthMorrisPrattMatcher(byte[] delimiter) {
|
public KnuthMorrisPrattMatcher(byte[] delimiter) {
|
||||||
this.delimiter = Arrays.copyOf(delimiter, delimiter.length);
|
this.delimiter = Arrays.copyOf(delimiter, delimiter.length);
|
||||||
this.table = longestSuffixPrefixTable(delimiter);
|
this.table = longestSuffixPrefixTable(delimiter);
|
||||||
|
|
@ -935,6 +932,7 @@ public abstract class DataBufferUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of {@link Matcher} that wraps several other matchers.
|
* Implementation of {@link Matcher} that wraps several other matchers.
|
||||||
*/
|
*/
|
||||||
|
|
@ -946,7 +944,6 @@ public abstract class DataBufferUtils {
|
||||||
|
|
||||||
byte[] longestDelimiter = NO_DELIMITER;
|
byte[] longestDelimiter = NO_DELIMITER;
|
||||||
|
|
||||||
|
|
||||||
public CompositeMatcher(Matcher[] matchers) {
|
public CompositeMatcher(Matcher[] matchers) {
|
||||||
this.matchers = matchers;
|
this.matchers = matchers;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,6 @@ public interface RouteMatcher {
|
||||||
*/
|
*/
|
||||||
Route parseRoute(String routeValue);
|
Route parseRoute(String routeValue);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the given {@code route} contains pattern syntax which requires
|
* Whether the given {@code route} contains pattern syntax which requires
|
||||||
* the {@link #match(String, Route)} method, or if it is a regular String
|
* the {@link #match(String, Route)} method, or if it is a regular String
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.util;
|
package org.springframework.util;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
|
@ -36,12 +37,18 @@ public class SimpleRouteMatcher implements RouteMatcher {
|
||||||
private final PathMatcher pathMatcher;
|
private final PathMatcher pathMatcher;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new {@code SimpleRouteMatcher} for the given
|
||||||
|
* {@link PathMatcher} delegate.
|
||||||
|
*/
|
||||||
public SimpleRouteMatcher(PathMatcher pathMatcher) {
|
public SimpleRouteMatcher(PathMatcher pathMatcher) {
|
||||||
Assert.notNull(pathMatcher, "PathMatcher is required");
|
Assert.notNull(pathMatcher, "PathMatcher is required");
|
||||||
this.pathMatcher = pathMatcher;
|
this.pathMatcher = pathMatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the underlying {@link PathMatcher} delegate.
|
||||||
|
*/
|
||||||
public PathMatcher getPathMatcher() {
|
public PathMatcher getPathMatcher() {
|
||||||
return this.pathMatcher;
|
return this.pathMatcher;
|
||||||
}
|
}
|
||||||
|
|
@ -86,12 +93,10 @@ public class SimpleRouteMatcher implements RouteMatcher {
|
||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
|
|
||||||
|
|
||||||
DefaultRoute(String path) {
|
DefaultRoute(String path) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String value() {
|
public String value() {
|
||||||
return this.path;
|
return this.path;
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ public abstract class ScriptUtils {
|
||||||
* Default prefixes for single-line comments within SQL scripts: {@code ["--"]}.
|
* Default prefixes for single-line comments within SQL scripts: {@code ["--"]}.
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
public static final String[] DEFAULT_COMMENT_PREFIXES = { DEFAULT_COMMENT_PREFIX };
|
public static final String[] DEFAULT_COMMENT_PREFIXES = {DEFAULT_COMMENT_PREFIX};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default start delimiter for block comments within SQL scripts: {@code "/*"}.
|
* Default start delimiter for block comments within SQL scripts: {@code "/*"}.
|
||||||
|
|
@ -214,8 +214,8 @@ public abstract class ScriptUtils {
|
||||||
Assert.hasText(script, "'script' must not be null or empty");
|
Assert.hasText(script, "'script' must not be null or empty");
|
||||||
Assert.notNull(separator, "'separator' must not be null");
|
Assert.notNull(separator, "'separator' must not be null");
|
||||||
Assert.notEmpty(commentPrefixes, "'commentPrefixes' must not be null or empty");
|
Assert.notEmpty(commentPrefixes, "'commentPrefixes' must not be null or empty");
|
||||||
for (int i = 0; i < commentPrefixes.length; i++) {
|
for (String commentPrefix : commentPrefixes) {
|
||||||
Assert.hasText(commentPrefixes[i], "'commentPrefixes' must not contain null or empty elements");
|
Assert.hasText(commentPrefix, "'commentPrefixes' must not contain null or empty elements");
|
||||||
}
|
}
|
||||||
Assert.hasText(blockCommentStartDelimiter, "'blockCommentStartDelimiter' must not be null or empty");
|
Assert.hasText(blockCommentStartDelimiter, "'blockCommentStartDelimiter' must not be null or empty");
|
||||||
Assert.hasText(blockCommentEndDelimiter, "'blockCommentEndDelimiter' must not be null or empty");
|
Assert.hasText(blockCommentEndDelimiter, "'blockCommentEndDelimiter' must not be null or empty");
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public interface ReactiveMessageHandler {
|
||||||
/**
|
/**
|
||||||
* Handle the given message.
|
* Handle the given message.
|
||||||
* @param message the message to be handled
|
* @param message the message to be handled
|
||||||
* @return a completion {@link Mono} for the result of the message handling.
|
* @return a completion {@link Mono} for the result of the message handling
|
||||||
*/
|
*/
|
||||||
Mono<Void> handleMessage(Message<?> message);
|
Mono<Void> handleMessage(Message<?> message);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,10 @@ public @interface ConnectMapping {
|
||||||
* Mappings expressed by this annotation to match to the route from the
|
* Mappings expressed by this annotation to match to the route from the
|
||||||
* metadata of the initial {@link ConnectionSetupPayload} or in
|
* metadata of the initial {@link ConnectionSetupPayload} or in
|
||||||
* subsequent metadata pushes.
|
* subsequent metadata pushes.
|
||||||
*
|
|
||||||
* <p>Depending on the configured
|
* <p>Depending on the configured
|
||||||
* {@link org.springframework.util.RouteMatcher RouteMatcher}, the pattern may be
|
* {@link org.springframework.util.RouteMatcher RouteMatcher}, the pattern may be
|
||||||
* {@link org.springframework.util.AntPathMatcher AntPathMatcher} or
|
* {@link org.springframework.util.AntPathMatcher AntPathMatcher} or
|
||||||
* {@link org.springframework.web.util.pattern.PathPattern PathPattern} based.
|
* {@link org.springframework.web.util.pattern.PathPattern PathPattern} based.
|
||||||
*
|
|
||||||
* <p>By default this is an empty array in which case it matches all
|
* <p>By default this is an empty array in which case it matches all
|
||||||
* {@link ConnectionSetupPayload} and metadata pushes.
|
* {@link ConnectionSetupPayload} and metadata pushes.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -1053,7 +1053,6 @@ public class StompBrokerRelayMessageHandler extends AbstractBrokerMessageHandler
|
||||||
|
|
||||||
private final AtomicInteger disconnect = new AtomicInteger();
|
private final AtomicInteger disconnect = new AtomicInteger();
|
||||||
|
|
||||||
|
|
||||||
public void incrementConnectCount() {
|
public void incrementConnectCount() {
|
||||||
this.connect.incrementAndGet();
|
this.connect.incrementAndGet();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -125,9 +125,7 @@ public class TransactionSynchronizationManager {
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
private Object doGetResource(Object actualKey) {
|
private Object doGetResource(Object actualKey) {
|
||||||
Map<Object, Object> map = this.transactionContext.getResources();
|
return this.transactionContext.getResources().get(actualKey);
|
||||||
Object value = map.get(actualKey);
|
|
||||||
return value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,6 @@ public final class MultipartBodyBuilder {
|
||||||
* @param elementClass the type of elements contained in the publisher
|
* @param elementClass the type of elements contained in the publisher
|
||||||
* @return builder that allows for further customization of part headers
|
* @return builder that allows for further customization of part headers
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public <T, P extends Publisher<T>> PartBuilder asyncPart(String name, P publisher, Class<T> elementClass) {
|
public <T, P extends Publisher<T>> PartBuilder asyncPart(String name, P publisher, Class<T> elementClass) {
|
||||||
Assert.hasLength(name, "'name' must not be empty");
|
Assert.hasLength(name, "'name' must not be empty");
|
||||||
Assert.notNull(publisher, "'publisher' must not be null");
|
Assert.notNull(publisher, "'publisher' must not be null");
|
||||||
|
|
|
||||||
|
|
@ -53,21 +53,6 @@ public class JettyClientHttpConnector implements ClientHttpConnector {
|
||||||
this(new HttpClient());
|
this(new HttpClient());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor with an {@link JettyResourceFactory} that will manage shared resources.
|
|
||||||
* @param resourceFactory the {@link JettyResourceFactory} to use
|
|
||||||
* @param customizer the lambda used to customize the {@link HttpClient}
|
|
||||||
* @deprecated as of 5.2, in favor of {@link JettyClientHttpConnector#JettyClientHttpConnector(HttpClient, JettyResourceFactory)}
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public JettyClientHttpConnector(
|
|
||||||
JettyResourceFactory resourceFactory, @Nullable Consumer<HttpClient> customizer) {
|
|
||||||
this(new HttpClient(), resourceFactory);
|
|
||||||
if (customizer != null) {
|
|
||||||
customizer.accept(this.httpClient);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor with an initialized {@link HttpClient}.
|
* Constructor with an initialized {@link HttpClient}.
|
||||||
*/
|
*/
|
||||||
|
|
@ -82,8 +67,7 @@ public class JettyClientHttpConnector implements ClientHttpConnector {
|
||||||
* @param resourceFactory the {@link JettyResourceFactory} to use
|
* @param resourceFactory the {@link JettyResourceFactory} to use
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
public JettyClientHttpConnector(HttpClient httpClient,
|
public JettyClientHttpConnector(HttpClient httpClient, @Nullable JettyResourceFactory resourceFactory) {
|
||||||
@Nullable JettyResourceFactory resourceFactory) {
|
|
||||||
Assert.notNull(httpClient, "HttpClient is required");
|
Assert.notNull(httpClient, "HttpClient is required");
|
||||||
if (resourceFactory != null) {
|
if (resourceFactory != null) {
|
||||||
httpClient.setExecutor(resourceFactory.getExecutor());
|
httpClient.setExecutor(resourceFactory.getExecutor());
|
||||||
|
|
@ -93,6 +77,20 @@ public class JettyClientHttpConnector implements ClientHttpConnector {
|
||||||
this.httpClient = httpClient;
|
this.httpClient = httpClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor with an {@link JettyResourceFactory} that will manage shared resources.
|
||||||
|
* @param resourceFactory the {@link JettyResourceFactory} to use
|
||||||
|
* @param customizer the lambda used to customize the {@link HttpClient}
|
||||||
|
* @deprecated as of 5.2, in favor of {@link JettyClientHttpConnector#JettyClientHttpConnector(HttpClient, JettyResourceFactory)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public JettyClientHttpConnector(JettyResourceFactory resourceFactory, @Nullable Consumer<HttpClient> customizer) {
|
||||||
|
this(new HttpClient(), resourceFactory);
|
||||||
|
if (customizer != null) {
|
||||||
|
customizer.accept(this.httpClient);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setBufferFactory(DataBufferFactory bufferFactory) {
|
public void setBufferFactory(DataBufferFactory bufferFactory) {
|
||||||
this.bufferFactory = bufferFactory;
|
this.bufferFactory = bufferFactory;
|
||||||
|
|
|
||||||
|
|
@ -130,8 +130,7 @@ public abstract class HttpAccessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initialize(ClientHttpRequest request) {
|
private void initialize(ClientHttpRequest request) {
|
||||||
this.clientHttpRequestInitializers.forEach(
|
this.clientHttpRequestInitializers.forEach(initializer -> initializer.initialize(request));
|
||||||
initializer -> initializer.initialize(request));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,10 @@ public class Jackson2CborDecoder extends AbstractJackson2Decoder {
|
||||||
Assert.isAssignable(CBORFactory.class, mapper.getFactory().getClass());
|
Assert.isAssignable(CBORFactory.class, mapper.getFactory().getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Flux<Object> decode(Publisher<DataBuffer> input, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) {
|
public Flux<Object> decode(Publisher<DataBuffer> input, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) {
|
||||||
throw new UnsupportedOperationException("Does not support stream decoding yet");
|
throw new UnsupportedOperationException("Does not support stream decoding yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,8 +52,10 @@ public class Jackson2CborEncoder extends AbstractJackson2Encoder {
|
||||||
Assert.isAssignable(CBORFactory.class, mapper.getFactory().getClass());
|
Assert.isAssignable(CBORFactory.class, mapper.getFactory().getClass());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Flux<DataBuffer> encode(Publisher<?> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) {
|
public Flux<DataBuffer> encode(Publisher<?> inputStream, DataBufferFactory bufferFactory, ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) {
|
||||||
throw new UnsupportedOperationException("Does not support stream encoding yet");
|
throw new UnsupportedOperationException("Does not support stream encoding yet");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -203,22 +203,18 @@ public class FormHttpMessageConverter implements HttpMessageConverter<MultiValue
|
||||||
* Add {@link MediaType} objects to be supported by this converter.
|
* Add {@link MediaType} objects to be supported by this converter.
|
||||||
* <p>The supplied {@code MediaType} objects will be appended to the list
|
* <p>The supplied {@code MediaType} objects will be appended to the list
|
||||||
* of {@linkplain #getSupportedMediaTypes() supported MediaType objects}.
|
* of {@linkplain #getSupportedMediaTypes() supported MediaType objects}.
|
||||||
* @param supportedMediaTypes a var-args list of {@code MediaType} objects
|
* @param supportedMediaTypes a var-args list of {@code MediaType} objects to add
|
||||||
* to add
|
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
* @see #setSupportedMediaTypes(List)
|
* @see #setSupportedMediaTypes(List)
|
||||||
*/
|
*/
|
||||||
public void addSupportedMediaTypes(MediaType... supportedMediaTypes) {
|
public void addSupportedMediaTypes(MediaType... supportedMediaTypes) {
|
||||||
Assert.notNull(supportedMediaTypes, "'supportedMediaTypes' must not be null");
|
Assert.notNull(supportedMediaTypes, "'supportedMediaTypes' must not be null");
|
||||||
Assert.noNullElements(supportedMediaTypes, "'supportedMediaTypes' must not contain null elements");
|
Assert.noNullElements(supportedMediaTypes, "'supportedMediaTypes' must not contain null elements");
|
||||||
for (MediaType mediaType : supportedMediaTypes) {
|
Collections.addAll(this.supportedMediaTypes, supportedMediaTypes);
|
||||||
this.supportedMediaTypes.add(mediaType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*
|
|
||||||
* @see #setSupportedMediaTypes(List)
|
* @see #setSupportedMediaTypes(List)
|
||||||
* @see #addSupportedMediaTypes(MediaType...)
|
* @see #addSupportedMediaTypes(MediaType...)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -148,18 +148,15 @@ public interface PathContainer {
|
||||||
*/
|
*/
|
||||||
public final static Options MESSAGE_ROUTE = Options.create('.', false);
|
public final static Options MESSAGE_ROUTE = Options.create('.', false);
|
||||||
|
|
||||||
|
|
||||||
private final char separator;
|
private final char separator;
|
||||||
|
|
||||||
private final boolean decodeAndParseSegments;
|
private final boolean decodeAndParseSegments;
|
||||||
|
|
||||||
|
|
||||||
private Options(char separator, boolean decodeAndParseSegments) {
|
private Options(char separator, boolean decodeAndParseSegments) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
this.decodeAndParseSegments = decodeAndParseSegments;
|
this.decodeAndParseSegments = decodeAndParseSegments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public char separator() {
|
public char separator() {
|
||||||
return this.separator;
|
return this.separator;
|
||||||
}
|
}
|
||||||
|
|
@ -168,7 +165,6 @@ public interface PathContainer {
|
||||||
return this.decodeAndParseSegments;
|
return this.decodeAndParseSegments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an {@link Options} instance with the given settings.
|
* Create an {@link Options} instance with the given settings.
|
||||||
* @param separator the separator for parsing the path into segments;
|
* @param separator the separator for parsing the path into segments;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.springframework.web.filter.reactive;
|
package org.springframework.web.filter.reactive;
|
||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,14 @@ import org.springframework.web.server.WebHandler;
|
||||||
*/
|
*/
|
||||||
public class ExceptionHandlingWebHandler extends WebHandlerDecorator {
|
public class ExceptionHandlingWebHandler extends WebHandlerDecorator {
|
||||||
|
|
||||||
|
|
||||||
private final List<WebExceptionHandler> exceptionHandlers;
|
private final List<WebExceptionHandler> exceptionHandlers;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create an {@code ExceptionHandlingWebHandler} for the given delegate.
|
||||||
|
* @param delegate the WebHandler delegate
|
||||||
|
* @param handlers the WebExceptionHandlers to apply
|
||||||
|
*/
|
||||||
public ExceptionHandlingWebHandler(WebHandler delegate, List<WebExceptionHandler> handlers) {
|
public ExceptionHandlingWebHandler(WebHandler delegate, List<WebExceptionHandler> handlers) {
|
||||||
super(delegate);
|
super(delegate);
|
||||||
List<WebExceptionHandler> handlersToUse = new ArrayList<>();
|
List<WebExceptionHandler> handlersToUse = new ArrayList<>();
|
||||||
|
|
@ -61,7 +65,6 @@ public class ExceptionHandlingWebHandler extends WebHandlerDecorator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Mono<Void> handle(ServerWebExchange exchange) {
|
public Mono<Void> handle(ServerWebExchange exchange) {
|
||||||
|
|
||||||
Mono<Void> completion;
|
Mono<Void> completion;
|
||||||
try {
|
try {
|
||||||
completion = super.handle(exchange);
|
completion = super.handle(exchange);
|
||||||
|
|
@ -73,7 +76,6 @@ public class ExceptionHandlingWebHandler extends WebHandlerDecorator {
|
||||||
for (WebExceptionHandler handler : this.exceptionHandlers) {
|
for (WebExceptionHandler handler : this.exceptionHandlers) {
|
||||||
completion = completion.onErrorResume(ex -> handler.handle(exchange, ex));
|
completion = completion.onErrorResume(ex -> handler.handle(exchange, ex));
|
||||||
}
|
}
|
||||||
|
|
||||||
return completion;
|
return completion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2018 the original author or authors.
|
* Copyright 2002-2019 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -33,12 +33,19 @@ public class WebHandlerDecorator implements WebHandler {
|
||||||
private final WebHandler delegate;
|
private final WebHandler delegate;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a {@code WebHandlerDecorator} for the given delegate.
|
||||||
|
* @param delegate the WebHandler delegate
|
||||||
|
*/
|
||||||
public WebHandlerDecorator(WebHandler delegate) {
|
public WebHandlerDecorator(WebHandler delegate) {
|
||||||
Assert.notNull(delegate, "'delegate' must not be null");
|
Assert.notNull(delegate, "'delegate' must not be null");
|
||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the wrapped delegate.
|
||||||
|
*/
|
||||||
public WebHandler getDelegate() {
|
public WebHandler getDelegate() {
|
||||||
return this.delegate;
|
return this.delegate;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ public interface UriBuilder {
|
||||||
* only (i.e. {@code ?foo} instead of {@code ?foo=bar}.
|
* only (i.e. {@code ?foo} instead of {@code ?foo=bar}.
|
||||||
* @param name the query parameter name
|
* @param name the query parameter name
|
||||||
* @param values the query parameter values
|
* @param values the query parameter values
|
||||||
* @since 5.2.0
|
* @since 5.2
|
||||||
* @see #queryParam(String, Object...)
|
* @see #queryParam(String, Object...)
|
||||||
*/
|
*/
|
||||||
UriBuilder queryParam(String name, @Nullable Collection<?> values);
|
UriBuilder queryParam(String name, @Nullable Collection<?> values);
|
||||||
|
|
@ -161,7 +161,7 @@ public interface UriBuilder {
|
||||||
* the same parameter. If no values are given, the query parameter is removed.
|
* the same parameter. If no values are given, the query parameter is removed.
|
||||||
* @param name the query parameter name
|
* @param name the query parameter name
|
||||||
* @param values the query parameter values
|
* @param values the query parameter values
|
||||||
* @since 5.2.0
|
* @since 5.2
|
||||||
* @see #replaceQueryParam(String, Object...)
|
* @see #replaceQueryParam(String, Object...)
|
||||||
*/
|
*/
|
||||||
UriBuilder replaceQueryParam(String name, @Nullable Collection<?> values);
|
UriBuilder replaceQueryParam(String name, @Nullable Collection<?> values);
|
||||||
|
|
|
||||||
|
|
@ -725,7 +725,7 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
|
||||||
* @param name the query parameter name
|
* @param name the query parameter name
|
||||||
* @param values the query parameter values
|
* @param values the query parameter values
|
||||||
* @return this UriComponentsBuilder
|
* @return this UriComponentsBuilder
|
||||||
* @since 5.2.0
|
* @since 5.2
|
||||||
* @see #queryParam(String, Object...)
|
* @see #queryParam(String, Object...)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -773,7 +773,7 @@ public class UriComponentsBuilder implements UriBuilder, Cloneable {
|
||||||
* @param values the query parameter values
|
* @param values the query parameter values
|
||||||
* @return this UriComponentsBuilder
|
* @return this UriComponentsBuilder
|
||||||
* @see #replaceQueryParam(String, Object...)
|
* @see #replaceQueryParam(String, Object...)
|
||||||
* @since 5.2.0
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public UriComponentsBuilder replaceQueryParam(String name, @Nullable Collection<?> values) {
|
public UriComponentsBuilder replaceQueryParam(String name, @Nullable Collection<?> values) {
|
||||||
|
|
|
||||||
|
|
@ -176,7 +176,6 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||||
return this.patternString;
|
return this.patternString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the pattern string contains pattern syntax that would require
|
* Whether the pattern string contains pattern syntax that would require
|
||||||
* use of {@link #matches(PathContainer)}, or if it is a regular String that
|
* use of {@link #matches(PathContainer)}, or if it is a regular String that
|
||||||
|
|
@ -184,7 +183,7 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
public boolean hasPatternSyntax() {
|
public boolean hasPatternSyntax() {
|
||||||
return this.score > 0 || this.patternString.indexOf('?') != -1;
|
return (this.score > 0 || this.patternString.indexOf('?') != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -218,9 +217,9 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||||
@Nullable
|
@Nullable
|
||||||
public PathMatchInfo matchAndExtract(PathContainer pathContainer) {
|
public PathMatchInfo matchAndExtract(PathContainer pathContainer) {
|
||||||
if (this.head == null) {
|
if (this.head == null) {
|
||||||
return hasLength(pathContainer) &&
|
return (hasLength(pathContainer) &&
|
||||||
!(this.matchOptionalTrailingSeparator && pathContainerIsJustSeparator(pathContainer))
|
!(this.matchOptionalTrailingSeparator && pathContainerIsJustSeparator(pathContainer)) ?
|
||||||
? null : PathMatchInfo.EMPTY;
|
null : PathMatchInfo.EMPTY);
|
||||||
}
|
}
|
||||||
else if (!hasLength(pathContainer)) {
|
else if (!hasLength(pathContainer)) {
|
||||||
if (this.head instanceof WildcardTheRestPathElement || this.head instanceof CaptureTheRestPathElement) {
|
if (this.head instanceof WildcardTheRestPathElement || this.head instanceof CaptureTheRestPathElement) {
|
||||||
|
|
@ -442,6 +441,7 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||||
return this.patternString;
|
return this.patternString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int getScore() {
|
int getScore() {
|
||||||
return this.score;
|
return this.score;
|
||||||
}
|
}
|
||||||
|
|
@ -537,30 +537,25 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||||
pathContainer.value().charAt(0) == getSeparator();
|
pathContainer.value().charAt(0) == getSeparator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holder for URI variables and path parameters (matrix variables) extracted
|
* Holder for URI variables and path parameters (matrix variables) extracted
|
||||||
* based on the pattern for a given matched path.
|
* based on the pattern for a given matched path.
|
||||||
*/
|
*/
|
||||||
public static class PathMatchInfo {
|
public static class PathMatchInfo {
|
||||||
|
|
||||||
private static final PathMatchInfo EMPTY =
|
private static final PathMatchInfo EMPTY = new PathMatchInfo(Collections.emptyMap(), Collections.emptyMap());
|
||||||
new PathMatchInfo(Collections.emptyMap(), Collections.emptyMap());
|
|
||||||
|
|
||||||
|
|
||||||
private final Map<String, String> uriVariables;
|
private final Map<String, String> uriVariables;
|
||||||
|
|
||||||
private final Map<String, MultiValueMap<String, String>> matrixVariables;
|
private final Map<String, MultiValueMap<String, String>> matrixVariables;
|
||||||
|
|
||||||
|
PathMatchInfo(Map<String, String> uriVars, @Nullable Map<String, MultiValueMap<String, String>> matrixVars) {
|
||||||
PathMatchInfo(Map<String, String> uriVars,
|
|
||||||
@Nullable Map<String, MultiValueMap<String, String>> matrixVars) {
|
|
||||||
|
|
||||||
this.uriVariables = Collections.unmodifiableMap(uriVars);
|
this.uriVariables = Collections.unmodifiableMap(uriVars);
|
||||||
this.matrixVariables = matrixVars != null ?
|
this.matrixVariables = (matrixVars != null ?
|
||||||
Collections.unmodifiableMap(matrixVars) : Collections.emptyMap();
|
Collections.unmodifiableMap(matrixVars) : Collections.emptyMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the extracted URI variables.
|
* Return the extracted URI variables.
|
||||||
*/
|
*/
|
||||||
|
|
@ -717,4 +712,5 @@ public class PathPattern implements Comparable<PathPattern> {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -154,8 +154,9 @@ public abstract class BodyInserters {
|
||||||
* @return the inserter to write a producer
|
* @return the inserter to write a producer
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
public static <T> BodyInserter<T, ReactiveHttpOutputMessage> fromProducer(T producer,
|
public static <T> BodyInserter<T, ReactiveHttpOutputMessage> fromProducer(
|
||||||
ParameterizedTypeReference<?> elementTypeRef) {
|
T producer, ParameterizedTypeReference<?> elementTypeRef) {
|
||||||
|
|
||||||
Assert.notNull(producer, "'producer' must not be null");
|
Assert.notNull(producer, "'producer' must not be null");
|
||||||
Assert.notNull(elementTypeRef, "'elementTypeRef' must not be null");
|
Assert.notNull(elementTypeRef, "'elementTypeRef' must not be null");
|
||||||
ReactiveAdapter adapter = ReactiveAdapterRegistry.getSharedInstance().getAdapter(producer.getClass());
|
ReactiveAdapter adapter = ReactiveAdapterRegistry.getSharedInstance().getAdapter(producer.getClass());
|
||||||
|
|
|
||||||
|
|
@ -91,9 +91,7 @@ public interface EntityResponse<T> extends ServerResponse {
|
||||||
* @return the created builder
|
* @return the created builder
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
static <T> Builder<T> fromProducer(T producer,
|
static <T> Builder<T> fromProducer(T producer, ParameterizedTypeReference<?> typeReference) {
|
||||||
ParameterizedTypeReference<?> typeReference) {
|
|
||||||
|
|
||||||
return new DefaultEntityResponseBuilder<>(producer,
|
return new DefaultEntityResponseBuilder<>(producer,
|
||||||
BodyInserters.fromProducer(producer, typeReference));
|
BodyInserters.fromProducer(producer, typeReference));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,6 @@ public abstract class RouterFunctions {
|
||||||
/**
|
/**
|
||||||
* Adds a route to the given handler function that handles all requests that match the
|
* Adds a route to the given handler function that handles all requests that match the
|
||||||
* given predicate.
|
* given predicate.
|
||||||
*
|
|
||||||
* @param predicate the request predicate to match
|
* @param predicate the request predicate to match
|
||||||
* @param handlerFunction the handler function to handle all requests that match the predicate
|
* @param handlerFunction the handler function to handle all requests that match the predicate
|
||||||
* @return this builder
|
* @return this builder
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ public abstract class AbstractHandlerMapping extends ApplicationObjectSupport
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
protected boolean hasCorsConfigurationSource(Object handler) {
|
protected boolean hasCorsConfigurationSource(Object handler) {
|
||||||
return handler instanceof CorsConfigurationSource || this.corsConfigurationSource != null;
|
return (handler instanceof CorsConfigurationSource || this.corsConfigurationSource != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,6 @@ public class SimpleUrlHandlerMapping extends AbstractUrlHandlerMapping {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@code SimpleUrlHandlerMapping} with default settings.
|
* Create a {@code SimpleUrlHandlerMapping} with default settings.
|
||||||
* @since 5.2
|
|
||||||
*/
|
*/
|
||||||
public SimpleUrlHandlerMapping() {
|
public SimpleUrlHandlerMapping() {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,7 @@ import org.springframework.web.server.ServerWebInputException;
|
||||||
*/
|
*/
|
||||||
public class RequestBodyMethodArgumentResolver extends AbstractMessageReaderArgumentResolver {
|
public class RequestBodyMethodArgumentResolver extends AbstractMessageReaderArgumentResolver {
|
||||||
|
|
||||||
public RequestBodyMethodArgumentResolver(List<HttpMessageReader<?>> readers,
|
public RequestBodyMethodArgumentResolver(List<HttpMessageReader<?>> readers, ReactiveAdapterRegistry registry) {
|
||||||
ReactiveAdapterRegistry registry) {
|
|
||||||
|
|
||||||
super(readers, registry);
|
super(readers, registry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -276,8 +276,8 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
@Bean
|
@Bean
|
||||||
public RequestMappingHandlerMapping requestMappingHandlerMapping(
|
public RequestMappingHandlerMapping requestMappingHandlerMapping(
|
||||||
ContentNegotiationManager mvcContentNegotiationManager,
|
ContentNegotiationManager mvcContentNegotiationManager,
|
||||||
FormattingConversionService mvcConversionService,
|
FormattingConversionService mvcConversionService, ResourceUrlProvider mvcResourceUrlProvider) {
|
||||||
ResourceUrlProvider mvcResourceUrlProvider) {
|
|
||||||
RequestMappingHandlerMapping mapping = createRequestMappingHandlerMapping();
|
RequestMappingHandlerMapping mapping = createRequestMappingHandlerMapping();
|
||||||
mapping.setOrder(0);
|
mapping.setOrder(0);
|
||||||
mapping.setInterceptors(getInterceptors(mvcConversionService, mvcResourceUrlProvider));
|
mapping.setInterceptors(getInterceptors(mvcConversionService, mvcResourceUrlProvider));
|
||||||
|
|
@ -477,8 +477,9 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
* paths to controller bean names.
|
* paths to controller bean names.
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public BeanNameUrlHandlerMapping beanNameHandlerMapping(FormattingConversionService mvcConversionService,
|
public BeanNameUrlHandlerMapping beanNameHandlerMapping(
|
||||||
ResourceUrlProvider mvcResourceUrlProvider) {
|
FormattingConversionService mvcConversionService, ResourceUrlProvider mvcResourceUrlProvider) {
|
||||||
|
|
||||||
BeanNameUrlHandlerMapping mapping = new BeanNameUrlHandlerMapping();
|
BeanNameUrlHandlerMapping mapping = new BeanNameUrlHandlerMapping();
|
||||||
mapping.setOrder(2);
|
mapping.setOrder(2);
|
||||||
mapping.setInterceptors(getInterceptors(mvcConversionService, mvcResourceUrlProvider));
|
mapping.setInterceptors(getInterceptors(mvcConversionService, mvcResourceUrlProvider));
|
||||||
|
|
@ -498,8 +499,9 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public RouterFunctionMapping routerFunctionMapping(FormattingConversionService mvcConversionService,
|
public RouterFunctionMapping routerFunctionMapping(
|
||||||
ResourceUrlProvider mvcResourceUrlProvider) {
|
FormattingConversionService mvcConversionService, ResourceUrlProvider mvcResourceUrlProvider) {
|
||||||
|
|
||||||
RouterFunctionMapping mapping = new RouterFunctionMapping();
|
RouterFunctionMapping mapping = new RouterFunctionMapping();
|
||||||
mapping.setOrder(3);
|
mapping.setOrder(3);
|
||||||
mapping.setInterceptors(getInterceptors(mvcConversionService, mvcResourceUrlProvider));
|
mapping.setInterceptors(getInterceptors(mvcConversionService, mvcResourceUrlProvider));
|
||||||
|
|
@ -516,10 +518,9 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
@Bean
|
@Bean
|
||||||
@Nullable
|
@Nullable
|
||||||
public HandlerMapping resourceHandlerMapping(UrlPathHelper mvcUrlPathHelper,
|
public HandlerMapping resourceHandlerMapping(UrlPathHelper mvcUrlPathHelper,
|
||||||
PathMatcher mvcPathMatcher,
|
PathMatcher mvcPathMatcher, ContentNegotiationManager mvcContentNegotiationManager,
|
||||||
ContentNegotiationManager mvcContentNegotiationManager,
|
FormattingConversionService mvcConversionService, ResourceUrlProvider mvcResourceUrlProvider) {
|
||||||
FormattingConversionService mvcConversionService,
|
|
||||||
ResourceUrlProvider mvcResourceUrlProvider) {
|
|
||||||
Assert.state(this.applicationContext != null, "No ApplicationContext set");
|
Assert.state(this.applicationContext != null, "No ApplicationContext set");
|
||||||
Assert.state(this.servletContext != null, "No ServletContext set");
|
Assert.state(this.servletContext != null, "No ServletContext set");
|
||||||
|
|
||||||
|
|
@ -597,8 +598,8 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
@Bean
|
@Bean
|
||||||
public RequestMappingHandlerAdapter requestMappingHandlerAdapter(
|
public RequestMappingHandlerAdapter requestMappingHandlerAdapter(
|
||||||
ContentNegotiationManager mvcContentNegotiationManager,
|
ContentNegotiationManager mvcContentNegotiationManager,
|
||||||
FormattingConversionService mvcConversionService,
|
FormattingConversionService mvcConversionService, Validator mvcValidator) {
|
||||||
Validator mvcValidator) {
|
|
||||||
RequestMappingHandlerAdapter adapter = createRequestMappingHandlerAdapter();
|
RequestMappingHandlerAdapter adapter = createRequestMappingHandlerAdapter();
|
||||||
adapter.setContentNegotiationManager(mvcContentNegotiationManager);
|
adapter.setContentNegotiationManager(mvcContentNegotiationManager);
|
||||||
adapter.setMessageConverters(getMessageConverters());
|
adapter.setMessageConverters(getMessageConverters());
|
||||||
|
|
@ -649,8 +650,8 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
* initializing all {@link WebDataBinder} instances.
|
* initializing all {@link WebDataBinder} instances.
|
||||||
*/
|
*/
|
||||||
protected ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer(
|
protected ConfigurableWebBindingInitializer getConfigurableWebBindingInitializer(
|
||||||
FormattingConversionService mvcConversionService,
|
FormattingConversionService mvcConversionService, Validator mvcValidator) {
|
||||||
Validator mvcValidator) {
|
|
||||||
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
|
ConfigurableWebBindingInitializer initializer = new ConfigurableWebBindingInitializer();
|
||||||
initializer.setConversionService(mvcConversionService);
|
initializer.setConversionService(mvcConversionService);
|
||||||
initializer.setValidator(mvcValidator);
|
initializer.setValidator(mvcValidator);
|
||||||
|
|
@ -980,6 +981,7 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
*/
|
*/
|
||||||
protected final void addDefaultHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers,
|
protected final void addDefaultHandlerExceptionResolvers(List<HandlerExceptionResolver> exceptionResolvers,
|
||||||
ContentNegotiationManager mvcContentNegotiationManager) {
|
ContentNegotiationManager mvcContentNegotiationManager) {
|
||||||
|
|
||||||
ExceptionHandlerExceptionResolver exceptionHandlerResolver = createExceptionHandlerExceptionResolver();
|
ExceptionHandlerExceptionResolver exceptionHandlerResolver = createExceptionHandlerExceptionResolver();
|
||||||
exceptionHandlerResolver.setContentNegotiationManager(mvcContentNegotiationManager);
|
exceptionHandlerResolver.setContentNegotiationManager(mvcContentNegotiationManager);
|
||||||
exceptionHandlerResolver.setMessageConverters(getMessageConverters());
|
exceptionHandlerResolver.setMessageConverters(getMessageConverters());
|
||||||
|
|
@ -1025,8 +1027,8 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||||
*/
|
*/
|
||||||
@Bean
|
@Bean
|
||||||
public ViewResolver mvcViewResolver(ContentNegotiationManager mvcContentNegotiationManager) {
|
public ViewResolver mvcViewResolver(ContentNegotiationManager mvcContentNegotiationManager) {
|
||||||
ViewResolverRegistry registry = new ViewResolverRegistry(
|
ViewResolverRegistry registry =
|
||||||
mvcContentNegotiationManager, this.applicationContext);
|
new ViewResolverRegistry(mvcContentNegotiationManager, this.applicationContext);
|
||||||
configureViewResolvers(registry);
|
configureViewResolvers(registry);
|
||||||
|
|
||||||
if (registry.getViewResolvers().isEmpty() && this.applicationContext != null) {
|
if (registry.getViewResolvers().isEmpty() && this.applicationContext != null) {
|
||||||
|
|
|
||||||
|
|
@ -485,7 +485,7 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
||||||
* @since 5.2
|
* @since 5.2
|
||||||
*/
|
*/
|
||||||
protected boolean hasCorsConfigurationSource(Object handler) {
|
protected boolean hasCorsConfigurationSource(Object handler) {
|
||||||
return handler instanceof CorsConfigurationSource || this.corsConfigurationSource != null;
|
return (handler instanceof CorsConfigurationSource || this.corsConfigurationSource != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,6 @@ public class SimpleUrlHandlerMapping extends AbstractUrlHandlerMapping {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a {@code SimpleUrlHandlerMapping} with default settings.
|
* Create a {@code SimpleUrlHandlerMapping} with default settings.
|
||||||
* @since 5.2
|
|
||||||
*/
|
*/
|
||||||
public SimpleUrlHandlerMapping() {
|
public SimpleUrlHandlerMapping() {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -303,14 +303,14 @@ public abstract class AbstractCachingViewResolver extends WebApplicationObjectSu
|
||||||
public interface CacheFilter {
|
public interface CacheFilter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indicates whether the given view should be cached. The name and
|
* Indicates whether the given view should be cached.
|
||||||
* locale used to resolve the view are also provided.
|
* The name and locale used to resolve the view are also provided.
|
||||||
* @param view the view
|
* @param view the view
|
||||||
* @param viewName the name used to resolve {@code view}
|
* @param viewName the name used to resolve the {@code view}
|
||||||
* @param locale the locale used to resolve {@code view}
|
* @param locale the locale used to resolve the {@code view}
|
||||||
* @return {@code true} if the view should be cached; {@code false}
|
* @return {@code true} if the view should be cached; {@code false} otherwise
|
||||||
* otherwise
|
|
||||||
*/
|
*/
|
||||||
boolean filter(View view, String viewName, Locale locale);
|
boolean filter(View view, String viewName, Locale locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -652,6 +652,7 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
|
||||||
return MessageBuilder.createMessage(EMPTY_PAYLOAD, headerAccessor.getMessageHeaders());
|
return MessageBuilder.createMessage(EMPTY_PAYLOAD, headerAccessor.getMessageHeaders());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "StompSubProtocolHandler" + getSupportedProtocols();
|
return "StompSubProtocolHandler" + getSupportedProtocols();
|
||||||
|
|
@ -689,7 +690,6 @@ public class StompSubProtocolHandler implements SubProtocolHandler, ApplicationE
|
||||||
|
|
||||||
private final AtomicInteger disconnect = new AtomicInteger();
|
private final AtomicInteger disconnect = new AtomicInteger();
|
||||||
|
|
||||||
|
|
||||||
public void incrementConnectCount() {
|
public void incrementConnectCount() {
|
||||||
this.connect.incrementAndGet();
|
this.connect.incrementAndGet();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -595,6 +595,7 @@ public class SubProtocolWebSocketHandler
|
||||||
int getTransportErrorSessions();
|
int getTransportErrorSessions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class DefaultStats implements Stats {
|
private class DefaultStats implements Stats {
|
||||||
|
|
||||||
private final AtomicInteger total = new AtomicInteger();
|
private final AtomicInteger total = new AtomicInteger();
|
||||||
|
|
@ -611,7 +612,6 @@ public class SubProtocolWebSocketHandler
|
||||||
|
|
||||||
private final AtomicInteger transportError = new AtomicInteger();
|
private final AtomicInteger transportError = new AtomicInteger();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTotalSessions() {
|
public int getTotalSessions() {
|
||||||
return this.total.get();
|
return this.total.get();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue