This is an automated email from the ASF dual-hosted git repository. markt pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 3bfd1044d5cf8689f16e416de12af76a8ffcdd74 Author: Mark Thomas <ma...@apache.org> AuthorDate: Thu Jun 16 18:24:06 2022 +0100 The limit on endpoint registration was removed in WebSocket 2.1 --- java/org/apache/tomcat/websocket/Constants.java | 10 ------- .../apache/tomcat/websocket/server/Constants.java | 11 ------- .../websocket/server/LocalStrings.properties | 1 - .../websocket/server/LocalStrings_fr.properties | 1 - .../websocket/server/LocalStrings_ja.properties | 1 - .../websocket/server/LocalStrings_ko.properties | 1 - .../websocket/server/LocalStrings_zh_CN.properties | 1 - .../tomcat/websocket/server/WsServerContainer.java | 34 ---------------------- webapps/docs/changelog.xml | 9 ++++++ webapps/docs/config/systemprops.xml | 11 ------- webapps/docs/web-socket-howto.xml | 10 ------- 11 files changed, 9 insertions(+), 81 deletions(-) diff --git a/java/org/apache/tomcat/websocket/Constants.java b/java/org/apache/tomcat/websocket/Constants.java index 73503186e4..e8b0ffaf1b 100644 --- a/java/org/apache/tomcat/websocket/Constants.java +++ b/java/org/apache/tomcat/websocket/Constants.java @@ -140,16 +140,6 @@ public class Constants { public static final String WS_AUTHENTICATION_USER_NAME = "org.apache.tomcat.websocket.WS_AUTHENTICATION_USER_NAME"; public static final String WS_AUTHENTICATION_PASSWORD = "org.apache.tomcat.websocket.WS_AUTHENTICATION_PASSWORD"; - /** - * WebSocket specification compliance flag. - * - * @deprecated This is no longer required in Jakarta EE 10 onwards and will - * be removed in Tomcat 10.1. - */ - @Deprecated - public static final boolean STRICT_SPEC_COMPLIANCE = - Boolean.getBoolean("org.apache.tomcat.websocket.STRICT_SPEC_COMPLIANCE"); - public static final List<Extension> INSTALLED_EXTENSIONS; static { diff --git a/java/org/apache/tomcat/websocket/server/Constants.java b/java/org/apache/tomcat/websocket/server/Constants.java index e900a540a9..d30c880af0 100644 --- a/java/org/apache/tomcat/websocket/server/Constants.java +++ b/java/org/apache/tomcat/websocket/server/Constants.java @@ -26,17 +26,6 @@ public class Constants { public static final String TEXT_BUFFER_SIZE_SERVLET_CONTEXT_INIT_PARAM = "org.apache.tomcat.websocket.textBufferSize"; - /** - * Allows the deployment restriction defined in section 6.4 of the Jakarta - * WebSocket specification to be ignored. - * - * @deprecated This is no longer required in Jakarta EE 10 onwards and will - * be removed in Tomcat 10.1. - */ - @Deprecated - public static final String ENFORCE_NO_ADD_AFTER_HANDSHAKE_CONTEXT_INIT_PARAM = - "org.apache.tomcat.websocket.noAddAfterHandshake"; - public static final String SERVER_CONTAINER_SERVLET_CONTEXT_ATTRIBUTE = "jakarta.websocket.server.ServerContainer"; diff --git a/java/org/apache/tomcat/websocket/server/LocalStrings.properties b/java/org/apache/tomcat/websocket/server/LocalStrings.properties index 0b6dfb1277..063b2c8ad4 100644 --- a/java/org/apache/tomcat/websocket/server/LocalStrings.properties +++ b/java/org/apache/tomcat/websocket/server/LocalStrings.properties @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -serverContainer.addNotAllowed=No further Endpoints may be registered once an attempt has been made to use one of the previously registered endpoints serverContainer.configuratorFail=Failed to create configurator of type [{0}] for POJO of type [{1}] serverContainer.duplicatePaths=Multiple Endpoints may not be deployed to the same path [{0}] : existing endpoint was [{1}] and new endpoint is [{2}] serverContainer.encoderFail=Unable to create encoder of type [{0}] diff --git a/java/org/apache/tomcat/websocket/server/LocalStrings_fr.properties b/java/org/apache/tomcat/websocket/server/LocalStrings_fr.properties index 872dd7c855..ee86986ba8 100644 --- a/java/org/apache/tomcat/websocket/server/LocalStrings_fr.properties +++ b/java/org/apache/tomcat/websocket/server/LocalStrings_fr.properties @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -serverContainer.addNotAllowed=Aucune terminaison ne peut être enregistré une fois qu'une tentative d'utilisation d'une des terminaisons précédemment enregistrée a été faite serverContainer.configuratorFail=Echec de création du configurateur de type [{0}] pour le POJO de type [{1}] serverContainer.duplicatePaths=Plusieurs terminaisons ne peuvent pas être déployés vers le même chemin [{0}] : la terminaison existante était [{1}] et la nouvelle est [{2}] serverContainer.encoderFail=Impossible de créer un encodeur de type [{0}] diff --git a/java/org/apache/tomcat/websocket/server/LocalStrings_ja.properties b/java/org/apache/tomcat/websocket/server/LocalStrings_ja.properties index ed1a42d17a..b219d63cf4 100644 --- a/java/org/apache/tomcat/websocket/server/LocalStrings_ja.properties +++ b/java/org/apache/tomcat/websocket/server/LocalStrings_ja.properties @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -serverContainer.addNotAllowed=以前に登録したことのあるエンドポイントには登録できません。 serverContainer.configuratorFail=POJO クラス [{1}] のインスタンスを構成するクラス [{0}] のインスタンスを作成できません。 serverContainer.duplicatePaths=複数のエンドポイントを同じパス [{0}] に配備することはできません: 既存のエンドポイントは [{1}] で、新しいエンドポイントは [{2}] です serverContainer.encoderFail=タイプ [{0}] のエンコーダを作成できません diff --git a/java/org/apache/tomcat/websocket/server/LocalStrings_ko.properties b/java/org/apache/tomcat/websocket/server/LocalStrings_ko.properties index bb1657691b..d80cbbb149 100644 --- a/java/org/apache/tomcat/websocket/server/LocalStrings_ko.properties +++ b/java/org/apache/tomcat/websocket/server/LocalStrings_ko.properties @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -serverContainer.addNotAllowed=이전에 등록된 엔드포인트들 중 하나라도 사용하려고 시도하게 되면, 엔드포인트들을 더 이상 등록할 수 없습니다. serverContainer.configuratorFail=타입이 [{1}]인 POJO를 위한 타입 [{0}]의 Configurator를 생성하지 못했습니다. serverContainer.duplicatePaths=여러 개의 엔드포인트들이 동일한 경로 [{0}]에 배치될 수 없습니다: 기존 엔드포인트는 [{1}]였으며 신규 엔드포인트는 [{2}]입니다. serverContainer.encoderFail=타입이 [{0}]인 인코더를 생성할 수 없습니다. diff --git a/java/org/apache/tomcat/websocket/server/LocalStrings_zh_CN.properties b/java/org/apache/tomcat/websocket/server/LocalStrings_zh_CN.properties index 3b7231a65c..2ff216355e 100644 --- a/java/org/apache/tomcat/websocket/server/LocalStrings_zh_CN.properties +++ b/java/org/apache/tomcat/websocket/server/LocalStrings_zh_CN.properties @@ -13,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -serverContainer.addNotAllowed=一旦尝试使用以前注册的终结点之一,就不能再注册其他终结点 serverContainer.configuratorFail=无法为[{1}]类型的POJO创建类型[{0}]的配置程序 serverContainer.duplicatePaths=多个端点可能不能发不到同一个路径[{0}]:已经存在的端点[{1}]和新的端点[{2}] serverContainer.encoderFail=无法创建[{0}]类型的编码器 diff --git a/java/org/apache/tomcat/websocket/server/WsServerContainer.java b/java/org/apache/tomcat/websocket/server/WsServerContainer.java index 5fa9d3c675..4bdc7cebf9 100644 --- a/java/org/apache/tomcat/websocket/server/WsServerContainer.java +++ b/java/org/apache/tomcat/websocket/server/WsServerContainer.java @@ -74,10 +74,6 @@ public class WsServerContainer extends WsWebSocketContainer private final Map<String,ExactPathMatch> configExactMatchMap = new ConcurrentHashMap<>(); private final Map<Integer,ConcurrentSkipListMap<String,TemplatePathMatch>> configTemplateMatchMap = new ConcurrentHashMap<>(); - @SuppressWarnings("deprecation") - private volatile boolean enforceNoAddAfterHandshake = - org.apache.tomcat.websocket.Constants.STRICT_SPEC_COMPLIANCE; - private volatile boolean addAllowed = true; private final Map<String,Set<WsSession>> authenticatedSessions = new ConcurrentHashMap<>(); private volatile boolean endpointsRegistered = false; private volatile boolean deploymentFailed = false; @@ -100,12 +96,6 @@ public class WsServerContainer extends WsWebSocketContainer setDefaultMaxTextMessageBufferSize(Integer.parseInt(value)); } - value = servletContext.getInitParameter( - Constants.ENFORCE_NO_ADD_AFTER_HANDSHAKE_CONTEXT_INIT_PARAM); - if (value != null) { - setEnforceNoAddAfterHandshake(Boolean.parseBoolean(value)); - } - FilterRegistration.Dynamic fr = servletContext.addFilter( "Tomcat WebSocket (JSR356) Filter", new WsFilter()); fr.setAsyncSupported(true); @@ -134,11 +124,6 @@ public class WsServerContainer extends WsWebSocketContainer void addEndpoint(ServerEndpointConfig sec, boolean fromAnnotatedPojo) throws DeploymentException { - if (enforceNoAddAfterHandshake && !addAllowed) { - throw new DeploymentException( - sm.getString("serverContainer.addNotAllowed")); - } - if (servletContext == null) { throw new DeploymentException( sm.getString("serverContainer.servletContextMissing")); @@ -312,12 +297,6 @@ public class WsServerContainer extends WsWebSocketContainer public WsMappingResult findMapping(String path) { - // Prevent registering additional endpoints once the first attempt has - // been made to use one - if (addAllowed) { - addAllowed = false; - } - // Check an exact match. Simple case as there are no templates. ExactPathMatch match = configExactMatchMap.get(path); if (match != null) { @@ -364,19 +343,6 @@ public class WsServerContainer extends WsWebSocketContainer } - @Deprecated - public boolean isEnforceNoAddAfterHandshake() { - return enforceNoAddAfterHandshake; - } - - - @Deprecated - public void setEnforceNoAddAfterHandshake( - boolean enforceNoAddAfterHandshake) { - this.enforceNoAddAfterHandshake = enforceNoAddAfterHandshake; - } - - protected WsWriteTimeout getTimeout() { return wsWriteTimeout; } diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml index 694eefbb79..43d152882b 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -150,6 +150,15 @@ </add> </changelog> </subsection> + <subsection name="WebSocket"> + <changelog> + <update> + Remove configuration settings related to the restriction on WebSocket + endpoint deployment that was removed in version 2.1 of the + specification. (markt) + </update> + </changelog> + </subsection> <subsection name="Web applications"> <changelog> <fix> diff --git a/webapps/docs/config/systemprops.xml b/webapps/docs/config/systemprops.xml index a555cd109a..a211bc5b1e 100644 --- a/webapps/docs/config/systemprops.xml +++ b/webapps/docs/config/systemprops.xml @@ -140,17 +140,6 @@ </ul> </property> - <property name="org.apache.tomcat.websocket. STRICT_SPEC_COMPLIANCE"> - <p>The default value of this system property is <code>false</code>.</p> - <p>If this is <code>true</code> the default values will be changed - to <code>true</code> instead of <code>false</code> for:</p> - <ul> - <li><code>org.apache.tomcat.websocket.server.WsServerContainer#isEnforceNoAddAfterHandshake</code></li> - </ul> - <p>This system property is deprecated and will be removed in Tomcat - 10.1.</p> - </property> - </properties> </section> diff --git a/webapps/docs/web-socket-howto.xml b/webapps/docs/web-socket-howto.xml index 927777f671..ac36b827de 100644 --- a/webapps/docs/web-socket-howto.xml +++ b/webapps/docs/web-socket-howto.xml @@ -95,16 +95,6 @@ <code>org.apache.tomcat.websocket.textBufferSize</code> to the desired value in bytes.</p> -<p>The Java WebSocket specification 1.0 does not permit programmatic deployment - after the first endpoint has started a WebSocket handshake. By default, - Tomcat continues to permit additional programmatic deployment. This - behavior is controlled by the - <code>org.apache.tomcat.websocket.noAddAfterHandshake</code> servlet context - initialization parameter. The default may be changed by setting the - <code>org.apache.tomcat.websocket.STRICT_SPEC_COMPLIANCE</code> system - property to <code>true</code> but any explicit setting on the servlet context - will always take priority.</p> - <p>When using the WebSocket client to connect to server endpoints, the timeout for IO operations while establishing the connection is controlled by the <code>userProperties</code> of the provided --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org