work in progress

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2018-12-05 14:45:23 +01:00
parent 13ee892921
commit e8d468b3e1
14 changed files with 32 additions and 28 deletions

View File

@ -53,7 +53,7 @@
<instructions> <instructions>
<Bundle-Description>javax.websocket.client Implementation</Bundle-Description> <Bundle-Description>javax.websocket.client Implementation</Bundle-Description>
<Export-Package> <Export-Package>
org.eclipse.jetty.websocket.jsr356.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" org.eclipse.jetty.websocket.javax.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}"
</Export-Package> </Export-Package>
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional</Require-Capability> <Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional</Require-Capability>
<Provide-Capability>osgi.serviceloader;osgi.serviceloader=javax.websocket.ContainerProvider</Provide-Capability> <Provide-Capability>osgi.serviceloader;osgi.serviceloader=javax.websocket.ContainerProvider</Provide-Capability>

View File

@ -31,7 +31,7 @@
<instructions> <instructions>
<Bundle-Description>javax.websocket.client Implementation</Bundle-Description> <Bundle-Description>javax.websocket.client Implementation</Bundle-Description>
<Export-Package> <Export-Package>
org.eclipse.jetty.websocket.jsr356.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" org.eclipse.jetty.websocket.javax.*;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}"
</Export-Package> </Export-Package>
</instructions> </instructions>
</configuration> </configuration>

View File

@ -67,7 +67,7 @@
<instructions> <instructions>
<Bundle-Description>javax.websocket.server Implementation</Bundle-Description> <Bundle-Description>javax.websocket.server Implementation</Bundle-Description>
<Export-Package> <Export-Package>
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}"
</Export-Package> </Export-Package>
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional</Require-Capability> <Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)";resolution:=optional</Require-Capability>
<Provide-Capability> <Provide-Capability>

View File

@ -38,6 +38,6 @@ public class JavaxWebSocketConfiguration extends AbstractConfiguration
addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class); addDependencies(WebXmlConfiguration.class, MetaInfConfiguration.class, WebInfConfiguration.class, FragmentConfiguration.class);
addDependents("org.eclipse.jetty.annotations.AnnotationConfiguration", WebAppConfiguration.class.getName()); addDependents("org.eclipse.jetty.annotations.AnnotationConfiguration", WebAppConfiguration.class.getName());
protectAndExpose("org.eclipse.jetty.websocket.servlet."); // For WebSocketUpgradeFilter 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?
} }
} }

View File

@ -47,10 +47,10 @@ import org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter;
@HandlesTypes({ ServerApplicationConfig.class, ServerEndpoint.class, Endpoint.class }) @HandlesTypes({ ServerApplicationConfig.class, ServerEndpoint.class, Endpoint.class })
public class JavaxWebSocketServerContainerInitializer implements ServletContainerInitializer public class JavaxWebSocketServerContainerInitializer implements ServletContainerInitializer
{ {
public static final String ENABLE_KEY = "org.eclipse.jetty.websocket.jsr356"; public static final String ENABLE_KEY = "org.eclipse.jetty.websocket.javax";
public static final String ADD_DYNAMIC_FILTER_KEY = "org.eclipse.jetty.websocket.jsr356.addDynamicFilter"; public static final String DEPRECATED_ENABLE_KEY = "org.eclipse.jetty.websocket.jsr356";
private static final Logger LOG = Log.getLogger(JavaxWebSocketServerContainerInitializer.class); 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 * DestroyListener
@ -89,7 +89,7 @@ public class JavaxWebSocketServerContainerInitializer implements ServletContaine
* @param defValue the default value, if the value is not specified in the context * @param defValue the default value, if the value is not specified in the context
* @return the value for the feature key * @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 // Try context parameters first
String cp = context.getInitParameter(keyName); String cp = context.getInitParameter(keyName);
@ -197,9 +197,15 @@ public class JavaxWebSocketServerContainerInitializer implements ServletContaine
@Override @Override
public void onStartup(Set<Class<?>> c, ServletContext context) throws ServletException public void onStartup(Set<Class<?>> 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; return;
} }
@ -207,12 +213,12 @@ public class JavaxWebSocketServerContainerInitializer implements ServletContaine
if (handler == null) 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)) 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; ServletContextHandler jettyContext = (ServletContextHandler)handler;

View File

@ -57,7 +57,7 @@
<instructions> <instructions>
<Bundle-Description>javax.websocket Integration Tests</Bundle-Description> <Bundle-Description>javax.websocket Integration Tests</Bundle-Description>
<Export-Package> <Export-Package>
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}"
</Export-Package> </Export-Package>
</instructions> </instructions>
</configuration> </configuration>

View File

@ -127,7 +127,7 @@ public class WSServer extends LocalServer implements LocalFuzzer.Provider
WebAppContext context = new WebAppContext(); WebAppContext context = new WebAppContext();
context.setContextPath(this.contextPath); context.setContextPath(this.contextPath);
context.setBaseResource(new PathResource(this.contextDir)); 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 AnnotationConfiguration());
context.addConfiguration(new PlusConfiguration()); context.addConfiguration(new PlusConfiguration());

View File

@ -7,7 +7,7 @@
version="3.1"> version="3.1">
<context-param> <context-param>
<param-name>org.eclipse.jetty.websocket.jsr356.addDynamicFilter</param-name> <param-name>org.eclipse.jetty.websocket.javax.addDynamicFilter</param-name>
<param-value>false</param-value> <param-value>false</param-value>
</context-param> </context-param>

View File

@ -19,8 +19,6 @@
</encoder> </encoder>
</appender> </appender>
<!--<logger name="org.eclipse.jetty.websocket.tests.client.jsr356" level="debug" />-->
<logger name="org.eclipse.jetty.websocket.core.internal.Parser.CLIENT" level="debug" additivity="false"> <logger name="org.eclipse.jetty.websocket.core.internal.Parser.CLIENT" level="debug" additivity="false">
<appender-ref ref="FILE"/> <appender-ref ref="FILE"/>
</logger> </logger>
@ -33,4 +31,4 @@
<appender-ref ref="STDOUT"/> <appender-ref ref="STDOUT"/>
</root> </root>
</configuration> </configuration>

View File

@ -7,7 +7,7 @@
version="3.1"> version="3.1">
<listener> <listener>
<listener-class>org.eclipse.jetty.websocket.jsr356.tests.server.InfoContextAltAttributeListener</listener-class> <listener-class>org.eclipse.jetty.websocket.javax.tests.server.InfoContextAltAttributeListener</listener-class>
</listener> </listener>
<filter> <filter>

View File

@ -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" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"> version="3.1">
<!-- disable JSR-356 --> <!-- disable Javax WebSockets -->
<context-param> <context-param>
<param-name>org.eclipse.jetty.websocket.jsr356</param-name> <param-name>org.eclipse.jetty.websocket.javax</param-name>
<param-value>false</param-value> <param-value>false</param-value>
</context-param> </context-param>
<listener> <listener>
<listener-class>org.eclipse.jetty.websocket.jsr356.tests.server.InfoContextAttributeListener</listener-class> <listener-class>org.eclipse.jetty.websocket.javax.tests.server.InfoContextAttributeListener</listener-class>
</listener> </listener>
<filter> <filter>

View File

@ -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" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"> version="3.1">
<!-- disable JSR-356 --> <!-- disable Javax Websockets -->
<context-param> <context-param>
<param-name>org.eclipse.jetty.websocket.jsr356</param-name> <param-name>org.eclipse.jetty.websocket.javax</param-name>
<param-value>false</param-value> <param-value>false</param-value>
</context-param> </context-param>
<servlet> <servlet>
<servlet-name>info-servlet</servlet-name> <servlet-name>info-servlet</servlet-name>
<servlet-class>org.eclipse.jetty.websocket.jsr356.tests.server.InfoServlet</servlet-class> <servlet-class>org.eclipse.jetty.websocket.javax.tests.server.InfoServlet</servlet-class>
<load-on-startup>1</load-on-startup> <load-on-startup>1</load-on-startup>
</servlet> </servlet>

View File

@ -17,12 +17,12 @@
<modules> <modules>
<module>websocket-core</module> <module>websocket-core</module>
<module>websocket-servlet</module> <module>websocket-servlet</module>
<!-- Jetty Native WebSocket Implementation --> <!-- Jetty WebSocket Implementation -->
<module>jetty-websocket-api</module> <module>jetty-websocket-api</module>
<module>jetty-websocket-common</module> <module>jetty-websocket-common</module>
<module>jetty-websocket-client</module> <module>jetty-websocket-client</module>
<module>jetty-websocket-server</module> <module>jetty-websocket-server</module>
<!-- JSR356 Implementation --> <!-- Javax WebSocket Implementation -->
<module>javax-websocket-common</module> <module>javax-websocket-common</module>
<module>javax-websocket-client</module> <module>javax-websocket-client</module>
<module>javax-websocket-server</module> <module>javax-websocket-server</module>

View File

@ -31,7 +31,7 @@ detected.
<!-- Enable WebSocket container --> <!-- Enable WebSocket container -->
<Call name="setAttribute"> <Call name="setAttribute">
<Arg>org.eclipse.jetty.websocket.jsr356</Arg> <Arg>org.eclipse.jetty.websocket.javax</Arg>
<Arg type="Boolean">true</Arg> <Arg type="Boolean">true</Arg>
</Call> </Call>