Jetty WebSockets no longer use shared mapping

mapping is now created for each WebSocketServlet

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2019-01-22 11:55:18 +11:00
parent e1674cf4b6
commit 4008005a0e
2 changed files with 9 additions and 19 deletions

View File

@ -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<Class<?>> 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);
}
}

View File

@ -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)