From 4008005a0e4a957f3db40f95c705b670e193ba75 Mon Sep 17 00:00:00 2001 From: Lachlan Roberts Date: Tue, 22 Jan 2019 11:55:18 +1100 Subject: [PATCH] Jetty WebSockets no longer use shared mapping mapping is now created for each WebSocketServlet Signed-off-by: Lachlan Roberts --- ...yWebSocketServletContainerInitializer.java | 26 ++++++------------- .../websocket/servlet/WebSocketServlet.java | 2 +- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/jetty-websocket/jetty-websocket-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServletContainerInitializer.java b/jetty-websocket/jetty-websocket-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServletContainerInitializer.java index af9e32b2c63..0d902b4800e 100644 --- a/jetty-websocket/jetty-websocket-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServletContainerInitializer.java +++ b/jetty-websocket/jetty-websocket-server/src/main/java/org/eclipse/jetty/websocket/server/JettyWebSocketServletContainerInitializer.java @@ -18,25 +18,17 @@ package org.eclipse.jetty.websocket.server; -import org.eclipse.jetty.server.handler.ContextHandler; -import org.eclipse.jetty.servlet.FilterHolder; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.util.component.AbstractLifeCycle; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; -import org.eclipse.jetty.util.thread.QueuedThreadPool; -import org.eclipse.jetty.websocket.servlet.FrameHandlerFactory; -import org.eclipse.jetty.websocket.servlet.WebSocketMapping; -import org.eclipse.jetty.websocket.servlet.WebSocketUpgradeFilter; +import java.util.Collections; +import java.util.Set; import javax.servlet.ServletContainerInitializer; import javax.servlet.ServletContext; import javax.servlet.ServletException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.concurrent.Executor; + +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.util.component.AbstractLifeCycle; +import org.eclipse.jetty.util.log.Log; +import org.eclipse.jetty.util.log.Logger; /** * ServletContext configuration for Jetty Native WebSockets API. @@ -80,11 +72,9 @@ public class JettyWebSocketServletContainerInitializer implements ServletContain @Override public void onStartup(Set> c, ServletContext servletContext) throws ServletException { - WebSocketMapping mapping = WebSocketMapping.ensureMapping(servletContext); - FilterHolder upgradeFilter = WebSocketUpgradeFilter.ensureFilter(servletContext); JettyServerFrameHandlerFactory factory = JettyServerFrameHandlerFactory.ensureFactory(servletContext); if (LOG.isDebugEnabled()) - LOG.debug("onStartup {} {} {}",mapping, upgradeFilter, factory); + LOG.debug("onStartup {}", factory); } } diff --git a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketServlet.java b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketServlet.java index 1155fa40f86..bfdd09e6bd7 100644 --- a/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketServlet.java +++ b/jetty-websocket/websocket-servlet/src/main/java/org/eclipse/jetty/websocket/servlet/WebSocketServlet.java @@ -113,8 +113,8 @@ public abstract class WebSocketServlet extends HttpServlet { ServletContext servletContext = getServletContext(); - mapping = WebSocketMapping.ensureMapping(servletContext); resources = WebSocketResources.ensureWebSocketResources(servletContext); + mapping = new WebSocketMapping(resources); String max = getInitParameter("maxIdleTime"); if (max != null)