diff --git a/framework-docs/src/docs/asciidoc/web/websocket.adoc b/framework-docs/src/docs/asciidoc/web/websocket.adoc index 191914edde16..efa11b051630 100644 --- a/framework-docs/src/docs/asciidoc/web/websocket.adoc +++ b/framework-docs/src/docs/asciidoc/web/websocket.adoc @@ -184,7 +184,7 @@ HTTP requests. It is also easy to integrate into other HTTP processing scenarios by invoking `WebSocketHttpRequestHandler`. This is convenient and easy to understand. However, special considerations apply with regards to JSR-356 runtimes. -The Java WebSocket API (JSR-356) provides two deployment mechanisms. The first +The Jakarta WebSocket API (JSR-356) provides two deployment mechanisms. The first involves a Servlet container classpath scan (a Servlet 3 feature) at startup. The other is a registration API to use at Servlet container initialization. Neither of these mechanism makes it possible to use a single "`front controller`" @@ -193,17 +193,9 @@ requests -- such as Spring MVC's `DispatcherServlet`. This is a significant limitation of JSR-356 that Spring's WebSocket support addresses with server-specific `RequestUpgradeStrategy` implementations even when running in a JSR-356 runtime. -Such strategies currently exist for Tomcat, Jetty, GlassFish, WebLogic, WebSphere, and -Undertow (and WildFly). - - - -NOTE: A request to overcome the preceding limitation in the Java WebSocket API has been -created and can be followed at -https://github.com/eclipse-ee4j/websocket-api/issues/211[eclipse-ee4j/websocket-api#211]. -Tomcat, Undertow, and WebSphere provide their own API alternatives that -make it possible to do this, and it is also possible with Jetty. We are hopeful -that more servers will do the same. +Such strategies currently exist for Tomcat, Jetty, GlassFish, WebLogic, WebSphere, and Undertow +(and WildFly). As of Jakarta WebSocket 2.1, a standard request upgrade strategy is available +which Spring chooses on Jakarta EE 10 based web containers such as Tomcat 10.1 and Jetty 12. A secondary consideration is that Servlet containers with JSR-356 support are expected to perform a `ServletContainerInitializer` (SCI) scan that can slow down application diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerReadPublisher.java b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerReadPublisher.java index bec275652bab..d9a39fbdffa2 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerReadPublisher.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerReadPublisher.java @@ -38,7 +38,7 @@ * *

Specifically a base class for reading from the HTTP request body with * Servlet non-blocking I/O and Undertow XNIO as well as handling incoming - * WebSocket messages with standard Java WebSocket (JSR-356), Jetty, and + * WebSocket messages with standard Jakarta WebSocket (JSR-356), Jetty, and * Undertow. * * @author Arjen Poutsma diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java index bf4520ac86b3..0223f1f274a0 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteProcessor.java @@ -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. @@ -35,7 +35,7 @@ * *

Specifically a base class for writing to the HTTP response body with * Servlet non-blocking I/O and Undertow XNIO as well for writing WebSocket - * messages through the Java WebSocket API (JSR-356), Jetty, and Undertow. + * messages through the Jakarta WebSocket API (JSR-356), Jetty, and Undertow. * * @author Arjen Poutsma * @author Violeta Georgieva diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractListenerWebSocketSession.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractListenerWebSocketSession.java index 551436ca358a..ab2d9171ca94 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractListenerWebSocketSession.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/AbstractListenerWebSocketSession.java @@ -42,7 +42,7 @@ /** * Base class for {@link WebSocketSession} implementations that bridge between - * event-listener WebSocket APIs (e.g. Java WebSocket API JSR-356, Jetty, + * event-listener WebSocket APIs (e.g. Jakarta WebSocket API (JSR-356), Jetty, * Undertow) and Reactive Streams. * *

Also implements {@code Subscriber} so it can be used to subscribe to diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/StandardWebSocketHandlerAdapter.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/StandardWebSocketHandlerAdapter.java index 68fed3f2b5db..2f78f073e712 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/StandardWebSocketHandlerAdapter.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/StandardWebSocketHandlerAdapter.java @@ -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. @@ -36,8 +36,8 @@ import org.springframework.web.reactive.socket.WebSocketSession; /** - * Adapter for Java WebSocket API (JSR-356) that delegates events to a reactive - * {@link WebSocketHandler} and its session. + * Adapter for the Jakarta WebSocket API (JSR-356) that delegates events to a + * reactive {@link WebSocketHandler} and its session. * * @author Violeta Georgieva * @author Rossen Stoyanchev diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/StandardWebSocketClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/StandardWebSocketClient.java index 74e01b480ee9..a57ccc063e3e 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/StandardWebSocketClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/StandardWebSocketClient.java @@ -43,7 +43,7 @@ import org.springframework.web.reactive.socket.adapter.StandardWebSocketSession; /** - * {@link WebSocketClient} implementation for use with the Java WebSocket API. + * {@link WebSocketClient} implementation for use with the Jakarta WebSocket API. * * @author Violeta Georgieva * @author Rossen Stoyanchev diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/TomcatWebSocketClient.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/TomcatWebSocketClient.java index 72c44fc496b8..55d9b991f22f 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/TomcatWebSocketClient.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/client/TomcatWebSocketClient.java @@ -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. @@ -26,14 +26,15 @@ import org.springframework.web.reactive.socket.adapter.TomcatWebSocketSession; /** - * {@link WebSocketClient} implementation for use with the Java WebSocket API. + * {@link WebSocketClient} implementation for use with Tomcat, + * based on the Jakarta WebSocket API. * * @author Violeta Georgieva * @since 5.0 + * @see StandardWebSocketClient */ public class TomcatWebSocketClient extends StandardWebSocketClient { - public TomcatWebSocketClient() { this(new WsWebSocketContainer()); } diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/RequestUpgradeStrategy.java b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/RequestUpgradeStrategy.java index 059e52376dc1..09ed2403981c 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/RequestUpgradeStrategy.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/socket/server/RequestUpgradeStrategy.java @@ -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. @@ -33,11 +33,12 @@ * *

Typically there is one such strategy for every {@link ServerHttpRequest} * and {@link ServerHttpResponse} type except in the case of Servlet containers - * for which the standard Java WebSocket API JSR-356 does not define a way to + * for which the standard Jakarta WebSocket API (JSR-356) does not define a way to * upgrade a request so a custom strategy is needed for every Servlet container. * * @author Rossen Stoyanchev * @since 5.0 + * @see org.springframework.web.reactive.socket.server.upgrade.StandardWebSocketUpgradeStrategy */ public interface RequestUpgradeStrategy { diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/adapter/standard/package-info.java b/spring-websocket/src/main/java/org/springframework/web/socket/adapter/standard/package-info.java index 26d1c4b67bf2..fac5f85a06bb 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/adapter/standard/package-info.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/adapter/standard/package-info.java @@ -1,5 +1,5 @@ /** - * Adapter classes for the standard Java WebSocket API. + * Adapter classes for the standard Jakarta WebSocket API. */ @NonNullApi @NonNullFields diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/client/standard/StandardWebSocketClient.java b/spring-websocket/src/main/java/org/springframework/web/socket/client/standard/StandardWebSocketClient.java index f22c4e842b1b..801a28943997 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/client/standard/StandardWebSocketClient.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/client/standard/StandardWebSocketClient.java @@ -51,7 +51,7 @@ import org.springframework.web.socket.client.AbstractWebSocketClient; /** - * A WebSocketClient based on standard Java WebSocket API. + * A WebSocketClient based on the standard Jakarta WebSocket API. * * @author Rossen Stoyanchev * @since 4.0 @@ -88,7 +88,7 @@ public StandardWebSocketClient(WebSocketContainer webSocketContainer) { /** - * The standard Java WebSocket API allows passing "user properties" to the + * The standard Jakarta WebSocket API allows passing "user properties" to the * server via {@link ClientEndpointConfig#getUserProperties() userProperties}. * Use this property to configure one or more properties to be passed on * every handshake. diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/client/standard/package-info.java b/spring-websocket/src/main/java/org/springframework/web/socket/client/standard/package-info.java index 6bfe258f8b9c..501c3d4879d9 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/client/standard/package-info.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/client/standard/package-info.java @@ -1,5 +1,5 @@ /** - * Client-side classes for use with standard Java WebSocket endpoints. + * Client-side classes for use with standard Jakarta WebSocket endpoints. */ @NonNullApi @NonNullFields diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/server/RequestUpgradeStrategy.java b/spring-websocket/src/main/java/org/springframework/web/socket/server/RequestUpgradeStrategy.java index c88596017676..288193de2efa 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/server/RequestUpgradeStrategy.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/server/RequestUpgradeStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 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. @@ -31,6 +31,7 @@ * * @author Rossen Stoyanchev * @since 4.0 + * @see org.springframework.web.socket.server.standard.StandardWebSocketUpgradeStrategy */ public interface RequestUpgradeStrategy { diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointExporter.java b/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointExporter.java index ab0ebbbd2f4d..5c6b381eef0b 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointExporter.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointExporter.java @@ -37,7 +37,7 @@ /** * Detects beans of type {@link jakarta.websocket.server.ServerEndpointConfig} and registers - * with the standard Java WebSocket runtime. Also detects beans annotated with + * with the standard Jakarta WebSocket runtime. Also detects beans annotated with * {@link ServerEndpoint} and registers them as well. Although not required, it is likely * annotated endpoints should have their {@code configurator} property set to * {@link SpringConfigurator}. diff --git a/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointRegistration.java b/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointRegistration.java index bc42f3dc883d..382a31fdf47f 100644 --- a/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointRegistration.java +++ b/spring-websocket/src/main/java/org/springframework/web/socket/server/standard/ServerEndpointRegistration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 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. @@ -38,7 +38,7 @@ /** * An implementation of {@link jakarta.websocket.server.ServerEndpointConfig} for use in * Spring-based applications. A {@link ServerEndpointRegistration} bean is detected by - * {@link ServerEndpointExporter} and registered with a Java WebSocket runtime at startup. + * {@link ServerEndpointExporter} and registered with a Jakarta WebSocket runtime at startup. * *

Class constructors accept a singleton {@link jakarta.websocket.Endpoint} instance * or an Endpoint specified by type {@link Class}. When specified by type, the endpoint