Skip to content

Commit 7ce4d15

Browse files
committed
Merge branch '5.2.x'
2 parents 74d3044 + 913eca9 commit 7ce4d15

File tree

4 files changed

+44
-5
lines changed

4 files changed

+44
-5
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ configure(allprojects) { project ->
156156
}
157157
dependency 'org.apache.httpcomponents.client5:httpclient5:5.0.1'
158158
dependency 'org.apache.httpcomponents.core5:httpcore5-reactive:5.0.1'
159-
dependency "org.eclipse.jetty:jetty-reactive-httpclient:1.1.3"
159+
dependency "org.eclipse.jetty:jetty-reactive-httpclient:1.1.4"
160160

161161
dependency "org.jruby:jruby:9.2.11.1"
162162
dependency "org.python:jython-standalone:2.7.1"

spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/upgrade/ReactorNettyRequestUpgradeStrategy.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class ReactorNettyRequestUpgradeStrategy implements RequestUpgradeStrateg
5757
* @since 5.2.6
5858
*/
5959
public ReactorNettyRequestUpgradeStrategy() {
60-
this(WebsocketServerSpec.builder());
60+
this(WebsocketServerSpec::builder);
6161
}
6262

6363

@@ -83,7 +83,7 @@ public WebsocketServerSpec getWebsocketServerSpec() {
8383
return buildSpec(null);
8484
}
8585

86-
private WebsocketServerSpec buildSpec(@Nullable String subProtocol) {
86+
WebsocketServerSpec buildSpec(@Nullable String subProtocol) {
8787
WebsocketServerSpec.Builder builder = this.specBuilderSupplier.get();
8888
if (subProtocol != null) {
8989
builder.protocols(subProtocol);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/*
2+
* Copyright 2002-2020 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.web.reactive.socket.server.upgrade;
17+
18+
import org.junit.jupiter.api.Test;
19+
import reactor.netty.http.server.WebsocketServerSpec;
20+
21+
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
22+
23+
/**
24+
* Unit tests for {@link ReactorNettyRequestUpgradeStrategy}.
25+
* @author Rossen Stoyanchev
26+
*/
27+
public class ReactorNettyRequestUpgradeStrategyTests {
28+
29+
@Test // gh-25315
30+
void defaultWebSocketSpecBuilderIsUniquePerRequest() {
31+
ReactorNettyRequestUpgradeStrategy strategy = new ReactorNettyRequestUpgradeStrategy();
32+
WebsocketServerSpec spec1 = strategy.buildSpec("p1");
33+
WebsocketServerSpec spec2 = strategy.getWebsocketServerSpec();
34+
35+
assertThat(spec1.protocols()).isEqualTo("p1");
36+
assertThat(spec2.protocols()).isNull();
37+
}
38+
39+
}

spring-websocket/src/main/java/org/springframework/web/socket/adapter/standard/StandardWebSocketHandlerAdapter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -42,7 +42,7 @@
4242
*/
4343
public class StandardWebSocketHandlerAdapter extends Endpoint {
4444

45-
private static final Log logger = LogFactory.getLog(StandardWebSocketHandlerAdapter.class);
45+
private final Log logger = LogFactory.getLog(StandardWebSocketHandlerAdapter.class);
4646

4747
private final WebSocketHandler handler;
4848

0 commit comments

Comments
 (0)