From e8d468b3e101d07ad8e55ee73f96f2026f889a91 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Wed, 5 Dec 2018 14:45:23 +0100 Subject: [PATCH] work in progress Signed-off-by: Greg Wilkins --- .../javax-websocket-client/pom.xml | 2 +- .../javax-websocket-common/pom.xml | 2 +- .../javax-websocket-server/pom.xml | 2 +- .../server/JavaxWebSocketConfiguration.java | 2 +- ...axWebSocketServerContainerInitializer.java | 22 ++++++++++++------- jetty-websocket/javax-websocket-tests/pom.xml | 2 +- .../jetty/websocket/javax/tests/WSServer.java | 2 +- .../src/test/resources/alt-filter-web.xml | 2 +- .../src/test/resources/logback-test.xml | 4 +--- .../wsuf-alt-config-via-listener.xml | 2 +- .../resources/wsuf-config-via-listener.xml | 6 ++--- .../wsuf-config-via-servlet-init.xml | 6 ++--- jetty-websocket/pom.xml | 4 ++-- .../main/config/demo-base/webapps/test.xml | 2 +- 14 files changed, 32 insertions(+), 28 deletions(-) diff --git a/jetty-websocket/javax-websocket-client/pom.xml b/jetty-websocket/javax-websocket-client/pom.xml index 94727980578..e7015670e73 100644 --- a/jetty-websocket/javax-websocket-client/pom.xml +++ b/jetty-websocket/javax-websocket-client/pom.xml @@ -53,7 +53,7 @@ javax.websocket.client Implementation - org.eclipse.jetty.websocket.jsr356.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" + org.eclipse.jetty.websocket.javax.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional osgi.serviceloader;osgi.serviceloader=javax.websocket.ContainerProvider diff --git a/jetty-websocket/javax-websocket-common/pom.xml b/jetty-websocket/javax-websocket-common/pom.xml index 8bbbddad45c..2273bae2d4d 100644 --- a/jetty-websocket/javax-websocket-common/pom.xml +++ b/jetty-websocket/javax-websocket-common/pom.xml @@ -31,7 +31,7 @@ javax.websocket.client Implementation - org.eclipse.jetty.websocket.jsr356.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" + org.eclipse.jetty.websocket.javax.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" diff --git a/jetty-websocket/javax-websocket-server/pom.xml b/jetty-websocket/javax-websocket-server/pom.xml index 181d5efa747..dd0a5e1486d 100644 --- a/jetty-websocket/javax-websocket-server/pom.xml +++ b/jetty-websocket/javax-websocket-server/pom.xml @@ -67,7 +67,7 @@ javax.websocket.server Implementation - org.eclipse.jetty.websocket.jsr356.server.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" + org.eclipse.jetty.websocket.javax.server.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional diff --git a/jetty-websocket/javax-websocket-server/src/main/java/org/eclipse/jetty/websocket/javax/server/JavaxWebSocketConfiguration.java b/jetty-websocket/javax-websocket-server/src/main/java/org/eclipse/jetty/websocket/javax/server/JavaxWebSocketConfiguration.java index 9ab28ab8a9e..fa67c8b948f 100644 --- a/jetty-websocket/javax-websocket-server/src/main/java/org/eclipse/jetty/websocket/javax/server/JavaxWebSocketConfiguration.java +++ b/jetty-websocket/javax-websocket-server/src/main/java/org/eclipse/jetty/websocket/javax/server/JavaxWebSocketConfiguration.java @@ -38,6 +38,6 @@ public class JavaxWebSocketConfiguration extends AbstractConfiguration addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class); addDependents("org.eclipse.jetty.annotations.AnnotationConfiguration", WebAppConfiguration.class.getName()); protectAndExpose("org.eclipse.jetty.websocket.servlet."); // For WebSocketUpgradeFilter - protectAndExpose("org.eclipse.jetty.websocket.jsr356."); // TODO + protectAndExpose("org.eclipse.jetty.websocket.javax."); // TODO Do we need all classes? } } diff --git a/jetty-websocket/javax-websocket-server/src/main/java/org/eclipse/jetty/websocket/javax/server/JavaxWebSocketServerContainerInitializer.java b/jetty-websocket/javax-websocket-server/src/main/java/org/eclipse/jetty/websocket/javax/server/JavaxWebSocketServerContainerInitializer.java index f2472b5b8af..6b362c8cb45 100644 --- a/jetty-websocket/javax-websocket-server/src/main/java/org/eclipse/jetty/websocket/javax/server/JavaxWebSocketServerContainerInitializer.java +++ b/jetty-websocket/javax-websocket-server/src/main/java/org/eclipse/jetty/websocket/javax/server/JavaxWebSocketServerContainerInitializer.java @@ -47,10 +47,10 @@ import org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter; @HandlesTypes({ ServerApplicationConfig.class, ServerEndpoint.class, Endpoint.class }) public class JavaxWebSocketServerContainerInitializer implements ServletContainerInitializer { - public static final String ENABLE_KEY = "org.eclipse.jetty.websocket.jsr356"; - public static final String ADD_DYNAMIC_FILTER_KEY = "org.eclipse.jetty.websocket.jsr356.addDynamicFilter"; + public static final String ENABLE_KEY = "org.eclipse.jetty.websocket.javax"; + public static final String DEPRECATED_ENABLE_KEY = "org.eclipse.jetty.websocket.jsr356"; private static final Logger LOG = Log.getLogger(JavaxWebSocketServerContainerInitializer.class); - public static final String HTTPCLIENT_ATTRIBUTE = "org.eclipse.jetty.websocket.jsr356.HttpClient"; + public static final String HTTPCLIENT_ATTRIBUTE = "org.eclipse.jetty.websocket.javax.HttpClient"; /** * DestroyListener @@ -89,7 +89,7 @@ public class JavaxWebSocketServerContainerInitializer implements ServletContaine * @param defValue the default value, if the value is not specified in the context * @return the value for the feature key */ - public static boolean isEnabledViaContext(ServletContext context, String keyName, boolean defValue) + public static Boolean isEnabledViaContext(ServletContext context, String keyName, Boolean defValue) { // Try context parameters first String cp = context.getInitParameter(keyName); @@ -197,9 +197,15 @@ public class JavaxWebSocketServerContainerInitializer implements ServletContaine @Override public void onStartup(Set> c, ServletContext context) throws ServletException { - if (!isEnabledViaContext(context, ENABLE_KEY, true)) + Boolean dft = isEnabledViaContext(context, DEPRECATED_ENABLE_KEY, null); + if (dft==null) + dft = Boolean.TRUE; + else + LOG.warn("Deprecated parameter used: " + DEPRECATED_ENABLE_KEY); + + if (!isEnabledViaContext(context, ENABLE_KEY, dft)) { - LOG.info("JSR-356 is disabled by configuration for context {}", context.getContextPath()); + LOG.info("Javax Websocket is disabled by configuration for context {}", context.getContextPath()); return; } @@ -207,12 +213,12 @@ public class JavaxWebSocketServerContainerInitializer implements ServletContaine if (handler == null) { - throw new ServletException("Not running on Jetty, JSR-356 support unavailable"); + throw new ServletException("Not running on Jetty, Javax Websocket support unavailable"); } if (!(handler instanceof ServletContextHandler)) { - throw new ServletException("Not running in Jetty ServletContextHandler, JSR-356 support unavailable"); + throw new ServletException("Not running in Jetty ServletContextHandler, Javax Websocket support unavailable"); } ServletContextHandler jettyContext = (ServletContextHandler)handler; diff --git a/jetty-websocket/javax-websocket-tests/pom.xml b/jetty-websocket/javax-websocket-tests/pom.xml index b9879c4bcb2..313b473d32b 100644 --- a/jetty-websocket/javax-websocket-tests/pom.xml +++ b/jetty-websocket/javax-websocket-tests/pom.xml @@ -57,7 +57,7 @@ javax.websocket Integration Tests - org.eclipse.jetty.websocket.jsr356.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" + org.eclipse.jetty.websocket.javax.tests.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" diff --git a/jetty-websocket/javax-websocket-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/WSServer.java b/jetty-websocket/javax-websocket-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/WSServer.java index 1303584b663..530a67b0c24 100644 --- a/jetty-websocket/javax-websocket-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/WSServer.java +++ b/jetty-websocket/javax-websocket-tests/src/main/java/org/eclipse/jetty/websocket/javax/tests/WSServer.java @@ -127,7 +127,7 @@ public class WSServer extends LocalServer implements LocalFuzzer.Provider WebAppContext context = new WebAppContext(); context.setContextPath(this.contextPath); context.setBaseResource(new PathResource(this.contextDir)); - context.setAttribute("org.eclipse.jetty.websocket.jsr356", Boolean.TRUE); + context.setAttribute("org.eclipse.jetty.websocket.javax", Boolean.TRUE); context.addConfiguration(new AnnotationConfiguration()); context.addConfiguration(new PlusConfiguration()); diff --git a/jetty-websocket/javax-websocket-tests/src/test/resources/alt-filter-web.xml b/jetty-websocket/javax-websocket-tests/src/test/resources/alt-filter-web.xml index c9d1da34af5..f1723581a3a 100644 --- a/jetty-websocket/javax-websocket-tests/src/test/resources/alt-filter-web.xml +++ b/jetty-websocket/javax-websocket-tests/src/test/resources/alt-filter-web.xml @@ -7,7 +7,7 @@ version="3.1"> - org.eclipse.jetty.websocket.jsr356.addDynamicFilter + org.eclipse.jetty.websocket.javax.addDynamicFilter false diff --git a/jetty-websocket/javax-websocket-tests/src/test/resources/logback-test.xml b/jetty-websocket/javax-websocket-tests/src/test/resources/logback-test.xml index 554f8f7f405..88c686db780 100644 --- a/jetty-websocket/javax-websocket-tests/src/test/resources/logback-test.xml +++ b/jetty-websocket/javax-websocket-tests/src/test/resources/logback-test.xml @@ -19,8 +19,6 @@ - - @@ -33,4 +31,4 @@ - \ No newline at end of file + diff --git a/jetty-websocket/javax-websocket-tests/src/test/resources/wsuf-alt-config-via-listener.xml b/jetty-websocket/javax-websocket-tests/src/test/resources/wsuf-alt-config-via-listener.xml index fc49c7bb351..1479493aff3 100644 --- a/jetty-websocket/javax-websocket-tests/src/test/resources/wsuf-alt-config-via-listener.xml +++ b/jetty-websocket/javax-websocket-tests/src/test/resources/wsuf-alt-config-via-listener.xml @@ -7,7 +7,7 @@ version="3.1"> - org.eclipse.jetty.websocket.jsr356.tests.server.InfoContextAltAttributeListener + org.eclipse.jetty.websocket.javax.tests.server.InfoContextAltAttributeListener diff --git a/jetty-websocket/javax-websocket-tests/src/test/resources/wsuf-config-via-listener.xml b/jetty-websocket/javax-websocket-tests/src/test/resources/wsuf-config-via-listener.xml index de7f073d710..d9811f6e0e5 100644 --- a/jetty-websocket/javax-websocket-tests/src/test/resources/wsuf-config-via-listener.xml +++ b/jetty-websocket/javax-websocket-tests/src/test/resources/wsuf-config-via-listener.xml @@ -4,14 +4,14 @@ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> - + - org.eclipse.jetty.websocket.jsr356 + org.eclipse.jetty.websocket.javax false - org.eclipse.jetty.websocket.jsr356.tests.server.InfoContextAttributeListener + org.eclipse.jetty.websocket.javax.tests.server.InfoContextAttributeListener diff --git a/jetty-websocket/javax-websocket-tests/src/test/resources/wsuf-config-via-servlet-init.xml b/jetty-websocket/javax-websocket-tests/src/test/resources/wsuf-config-via-servlet-init.xml index b62895d90db..f8c8fbf61e9 100644 --- a/jetty-websocket/javax-websocket-tests/src/test/resources/wsuf-config-via-servlet-init.xml +++ b/jetty-websocket/javax-websocket-tests/src/test/resources/wsuf-config-via-servlet-init.xml @@ -4,15 +4,15 @@ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> - + - org.eclipse.jetty.websocket.jsr356 + org.eclipse.jetty.websocket.javax false info-servlet - org.eclipse.jetty.websocket.jsr356.tests.server.InfoServlet + org.eclipse.jetty.websocket.javax.tests.server.InfoServlet 1 diff --git a/jetty-websocket/pom.xml b/jetty-websocket/pom.xml index 1a36318409f..5f6a256d041 100644 --- a/jetty-websocket/pom.xml +++ b/jetty-websocket/pom.xml @@ -17,12 +17,12 @@ websocket-core websocket-servlet - + jetty-websocket-api jetty-websocket-common jetty-websocket-client jetty-websocket-server - + javax-websocket-common javax-websocket-client javax-websocket-server diff --git a/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/webapps/test.xml b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/webapps/test.xml index 10347114ba0..57a03fb1e8f 100644 --- a/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/webapps/test.xml +++ b/tests/test-webapps/test-jetty-webapp/src/main/config/demo-base/webapps/test.xml @@ -31,7 +31,7 @@ detected. - org.eclipse.jetty.websocket.jsr356 + org.eclipse.jetty.websocket.javax true