diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/InfoContextAttributeListener.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/InfoContextAttributeListener.java
new file mode 100644
index 00000000000..11697a03d33
--- /dev/null
+++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/InfoContextAttributeListener.java
@@ -0,0 +1,49 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.server;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+import org.eclipse.jetty.http.pathmap.ServletPathSpec;
+import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest;
+import org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse;
+import org.eclipse.jetty.websocket.servlet.WebSocketCreator;
+
+public class InfoContextAttributeListener implements WebSocketCreator, ServletContextListener
+{
+ @Override
+ public void contextInitialized(ServletContextEvent sce)
+ {
+ NativeWebSocketConfiguration configuration = (NativeWebSocketConfiguration) sce.getServletContext().getAttribute(NativeWebSocketConfiguration.class.getName());
+ configuration.getFactory().getPolicy().setMaxTextMessageSize(10 * 1024 * 1024);
+ configuration.addMapping(new ServletPathSpec("/info/*"), this);
+ }
+
+ @Override
+ public void contextDestroyed(ServletContextEvent sce)
+ {
+ }
+
+ @Override
+ public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp)
+ {
+ return new InfoSocket();
+ }
+}
diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/InfoServlet.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/InfoServlet.java
new file mode 100644
index 00000000000..8cdb07ef7d0
--- /dev/null
+++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/InfoServlet.java
@@ -0,0 +1,47 @@
+//
+// ========================================================================
+// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// All rights reserved. This program and the accompanying materials
+// are made available under the terms of the Eclipse Public License v1.0
+// and Apache License v2.0 which accompanies this distribution.
+//
+// The Eclipse Public License is available at
+// http://www.eclipse.org/legal/epl-v10.html
+//
+// The Apache License v2.0 is available at
+// http://www.opensource.org/licenses/apache2.0.php
+//
+// You may elect to redistribute this code under either of these licenses.
+// ========================================================================
+//
+
+package org.eclipse.jetty.websocket.server;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+
+import org.eclipse.jetty.http.pathmap.ServletPathSpec;
+import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest;
+import org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse;
+import org.eclipse.jetty.websocket.servlet.WebSocketCreator;
+
+public class InfoServlet extends HttpServlet implements WebSocketCreator
+{
+ @Override
+ public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp)
+ {
+ return new InfoSocket();
+ }
+
+ @Override
+ public void init(ServletConfig config) throws ServletException
+ {
+ ServletContext context = config.getServletContext();
+ NativeWebSocketConfiguration configuration = (NativeWebSocketConfiguration) context.getAttribute(NativeWebSocketConfiguration.class.getName());
+ configuration.getFactory().getPolicy().setMaxTextMessageSize(10 * 1024 * 1024);
+ configuration.addMapping(new ServletPathSpec("/info/*"), this);
+ }
+}
diff --git a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketUpgradeFilterTest.java b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketUpgradeFilterTest.java
index bef91c93979..14a55761790 100644
--- a/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketUpgradeFilterTest.java
+++ b/jetty-websocket/websocket-server/src/test/java/org/eclipse/jetty/websocket/server/WebSocketUpgradeFilterTest.java
@@ -210,7 +210,7 @@ public class WebSocketUpgradeFilterTest
WSServer server = new WSServer(testDir, "/");
server.copyClass(InfoSocket.class);
- server.copyClass(InfoContextListener.class);
+ server.copyClass(InfoContextAttributeListener.class);
server.copyWebInf("wsuf-config-via-listener.xml");
server.start();
@@ -220,6 +220,29 @@ public class WebSocketUpgradeFilterTest
return server.getServer();
}
}});
+
+ // WSUF from web.xml, SCI active, apply app-ws configuration via Servlet.init
+
+ cases.add(new Object[]{"wsuf/WebAppContext/web.xml/Servlet.init", new ServerProvider()
+ {
+ @Override
+ public Server newServer() throws Exception
+ {
+ File testDir = MavenTestingUtils.getTargetTestingDir("WSUF-webxml");
+
+ WSServer server = new WSServer(testDir, "/");
+
+ server.copyClass(InfoSocket.class);
+ server.copyClass(InfoServlet.class);
+ server.copyWebInf("wsuf-config-via-servlet-init.xml");
+ server.start();
+
+ WebAppContext webapp = server.createWebAppContext();
+ server.deployWebapp(webapp);
+
+ return server.getServer();
+ }
+ }});
return cases;
}
diff --git a/jetty-websocket/websocket-server/src/test/resources/wsuf-config-via-listener.xml b/jetty-websocket/websocket-server/src/test/resources/wsuf-config-via-listener.xml
index 1e75370335f..8e75569ae23 100644
--- a/jetty-websocket/websocket-server/src/test/resources/wsuf-config-via-listener.xml
+++ b/jetty-websocket/websocket-server/src/test/resources/wsuf-config-via-listener.xml
@@ -7,7 +7,7 @@
version="3.1">
- org.eclipse.jetty.websocket.server.InfoContextListener
+ org.eclipse.jetty.websocket.server.InfoContextAttributeListener
diff --git a/jetty-websocket/websocket-server/src/test/resources/wsuf-config-via-servlet-init.xml b/jetty-websocket/websocket-server/src/test/resources/wsuf-config-via-servlet-init.xml
new file mode 100644
index 00000000000..a2a082f53cd
--- /dev/null
+++ b/jetty-websocket/websocket-server/src/test/resources/wsuf-config-via-servlet-init.xml
@@ -0,0 +1,24 @@
+
+
+
+
+ info-servlet
+ org.eclipse.jetty.websocket.server.InfoServlet
+ 1
+
+
+
+ wsuf
+ org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter
+
+
+
+ wsuf
+ /*
+
+