Merge branch '5.3.x'
# Conflicts: # build.gradle # spring-messaging/src/main/java/org/springframework/messaging/rsocket/DefaultRSocketRequesterBuilder.java # spring-messaging/src/main/java/org/springframework/messaging/rsocket/MetadataEncoder.java # spring-messaging/src/main/java/org/springframework/messaging/simp/broker/OrderedMessageChannelDecorator.java # spring-messaging/src/main/java/org/springframework/messaging/simp/user/DefaultUserDestinationResolver.java # spring-test/src/main/java/org/springframework/test/web/servlet/request/MockHttpServletRequestBuilder.java # spring-web/src/main/java/org/springframework/http/HttpRange.java # spring-webflux/src/main/java/org/springframework/web/reactive/result/view/RedirectView.java # spring-webflux/src/main/java/org/springframework/web/reactive/socket/CloseStatus.java # spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/RedirectViewControllerRegistration.java
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -103,7 +103,7 @@ final class DefaultRSocketRequesterBuilder implements RSocketRequester.Builder {
|
||||
|
||||
@Override
|
||||
public RSocketRequester.Builder metadataMimeType(MimeType mimeType) {
|
||||
Assert.notNull(mimeType, "`metadataMimeType` is required");
|
||||
Assert.notNull(mimeType, "'metadataMimeType' is required");
|
||||
this.metadataMimeType = mimeType;
|
||||
return this;
|
||||
}
|
||||
@@ -281,7 +281,7 @@ final class DefaultRSocketRequesterBuilder implements RSocketRequester.Builder {
|
||||
Mono<DataBuffer> dataMono = Mono.empty();
|
||||
if (data != null) {
|
||||
ReactiveAdapter adapter = strategies.reactiveAdapterRegistry().getAdapter(data.getClass());
|
||||
Assert.isTrue(adapter == null || !adapter.isMultiValue(), "Expected single value: " + data);
|
||||
Assert.isTrue(adapter == null || !adapter.isMultiValue(), () -> "Expected single value: " + data);
|
||||
Mono<?> mono = (adapter != null ? Mono.from(adapter.toPublisher(data)) : Mono.just(data));
|
||||
dataMono = mono.map(value -> {
|
||||
ResolvableType type = ResolvableType.forClass(value.getClass());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -141,7 +141,8 @@ final class MetadataEncoder {
|
||||
}
|
||||
ReactiveAdapter adapter = this.strategies.reactiveAdapterRegistry().getAdapter(metadata.getClass());
|
||||
if (adapter != null) {
|
||||
Assert.isTrue(!adapter.isMultiValue(), "Expected single value: " + metadata);
|
||||
Object originalMetadata = metadata;
|
||||
Assert.isTrue(!adapter.isMultiValue(), () -> "Expected single value: " + originalMetadata);
|
||||
metadata = Mono.from(adapter.toPublisher(metadata)).defaultIfEmpty(NO_VALUE);
|
||||
this.hasAsyncValues = true;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -421,7 +421,7 @@ public class RSocketMessageHandler extends MessageMappingMessageHandler {
|
||||
String str = setupPayload.dataMimeType();
|
||||
MimeType dataMimeType = StringUtils.hasText(str) ? MimeTypeUtils.parseMimeType(str) : this.defaultDataMimeType;
|
||||
Assert.notNull(dataMimeType, "No `dataMimeType` in ConnectionSetupPayload and no default value");
|
||||
Assert.isTrue(isDataMimeTypeSupported(dataMimeType), "Data MimeType '" + dataMimeType + "' not supported");
|
||||
Assert.isTrue(isDataMimeTypeSupported(dataMimeType), () -> "Data MimeType '" + dataMimeType + "' not supported");
|
||||
|
||||
str = setupPayload.metadataMimeType();
|
||||
MimeType metaMimeType = StringUtils.hasText(str) ? MimeTypeUtils.parseMimeType(str) : this.defaultMetadataMimeType;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -138,7 +138,7 @@ public class SimpMessagingTemplate extends AbstractMessageSendingTemplate<String
|
||||
*/
|
||||
@Override
|
||||
public void send(Message<?> message) {
|
||||
Assert.notNull(message, "Message is required");
|
||||
Assert.notNull(message, "Message must not be null");
|
||||
String destination = SimpMessageHeaderAccessor.getDestination(message.getHeaders());
|
||||
if (destination != null) {
|
||||
sendInternal(message);
|
||||
@@ -224,7 +224,8 @@ public class SimpMessagingTemplate extends AbstractMessageSendingTemplate<String
|
||||
throws MessagingException {
|
||||
|
||||
Assert.notNull(user, "User must not be null");
|
||||
Assert.isTrue(!user.contains("%2F"), "Invalid sequence \"%2F\" in user name: " + user);
|
||||
String username = user;
|
||||
Assert.isTrue(!user.contains("%2F"), () -> "Invalid sequence \"%2F\" in user name: " + username);
|
||||
user = StringUtils.replace(user, "/", "%2F");
|
||||
destination = destination.startsWith("/") ? destination : "/" + destination;
|
||||
super.convertAndSend(this.destinationPrefix + user + destination, payload, headers, postProcessor);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -148,7 +148,7 @@ public class OrderedMessageChannelDecorator implements MessageChannel {
|
||||
public static void configureInterceptor(MessageChannel channel, boolean preserveOrder) {
|
||||
if (preserveOrder) {
|
||||
Assert.isInstanceOf(ExecutorSubscribableChannel.class, channel,
|
||||
"An ExecutorSubscribableChannel is required for `preservePublishOrder`");
|
||||
"An ExecutorSubscribableChannel is required for 'preservePublishOrder'");
|
||||
ExecutorSubscribableChannel execChannel = (ExecutorSubscribableChannel) channel;
|
||||
if (execChannel.getInterceptors().stream().noneMatch(i -> i instanceof CallbackInterceptor)) {
|
||||
execChannel.addInterceptor(0, new CallbackInterceptor());
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -212,7 +212,7 @@ public class StompHeaders implements MultiValueMap<String, String>, Serializable
|
||||
}
|
||||
Arrays.stream(acceptVersions).forEach(version ->
|
||||
Assert.isTrue(version != null && (version.equals("1.1") || version.equals("1.2")),
|
||||
"Invalid version: " + version));
|
||||
() -> "Invalid version: " + version));
|
||||
set(ACCEPT_VERSION, StringUtils.arrayToCommaDelimitedString(acceptVersions));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 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.
|
||||
@@ -179,7 +179,7 @@ public class DefaultUserDestinationResolver implements UserDestinationResolver {
|
||||
}
|
||||
Principal principal = SimpMessageHeaderAccessor.getUser(headers);
|
||||
String user = (principal != null ? principal.getName() : null);
|
||||
Assert.isTrue(user == null || !user.contains("%2F"), "Invalid sequence \"%2F\" in user name: " + user);
|
||||
Assert.isTrue(user == null || !user.contains("%2F"), () -> "Invalid sequence \"%2F\" in user name: " + user);
|
||||
Set<String> sessionIds = Collections.singleton(sessionId);
|
||||
return new ParseResult(sourceDestination, actualDestination, sourceDestination, sessionIds, user);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user