Fixing merge 9.2.x -> 9.3.x

This commit is contained in:
Joakim Erdfelt 2016-11-16 18:31:33 -07:00
parent bfadca49b5
commit 7930a3dac8
4 changed files with 10 additions and 18 deletions

View File

@ -37,7 +37,6 @@ import org.eclipse.jetty.io.ByteBufferPool;
import org.eclipse.jetty.io.MappedByteBufferPool;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.util.DecoratedObjectFactory;
import org.eclipse.jetty.util.TypeUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -201,20 +200,8 @@ public class WebSocketServerContainerInitializer implements ServletContainerInit
// Create the Jetty ServerContainer implementation
ServerContainer jettyContainer = configureContext(jettyContext);
context.addListener(new ContextDestroyListener()); //make sure context is cleaned up when the context stops
context.addListener(new ContextDestroyListener()); // make sure context is cleaned up when the context stops
// Establish the DecoratedObjectFactory thread local
// for various ServiceLoader initiated components to use.
DecoratedObjectFactory instantiator = (DecoratedObjectFactory)context.getAttribute(DecoratedObjectFactory.ATTR);
if (instantiator == null)
{
LOG.info("Using WebSocket local DecoratedObjectFactory - none found in ServletContext");
instantiator = new DecoratedObjectFactory();
}
// Store a reference to the ServerContainer per javax.websocket spec 1.0 final section 6.4 Programmatic Server Deployment
context.setAttribute(javax.websocket.server.ServerContainer.class.getName(),jettyContainer);
if (c.isEmpty())
{
if (LOG.isDebugEnabled())

View File

@ -221,9 +221,13 @@ public abstract class AbstractEventDriver extends AbstractLifeCycle implements I
public void openSession(WebSocketSession session)
{
if (LOG.isDebugEnabled())
LOG.debug("openSession({})",session);
{
LOG.debug("openSession({})", session);
LOG.debug("objectFactory={}", session.getContainerScope().getObjectFactory());
}
this.session = session;
this.session.getContainerScope().getObjectFactory().decorate(this.websocket);
try
{
this.onConnect();

View File

@ -18,8 +18,8 @@
package org.eclipse.jetty.websocket.server;
import org.eclipse.jetty.websocket.server.pathmap.PathMappings;
import org.eclipse.jetty.websocket.server.pathmap.PathSpec;
import org.eclipse.jetty.http.pathmap.PathMappings;
import org.eclipse.jetty.http.pathmap.PathSpec;
import org.eclipse.jetty.websocket.servlet.WebSocketCreator;
public class DefaultMappedWebSocketCreator implements MappedWebSocketCreator

View File

@ -292,6 +292,7 @@ public class WebSocketUpgradeFilter extends ContainerLifeCycle implements Filter
{
factory = new WebSocketServerFactory(policy, bufferPool);
}
factory.init(config.getServletContext());
addBean(factory, true);
// TODO: Policy isn't from attributes
@ -327,7 +328,7 @@ public class WebSocketUpgradeFilter extends ContainerLifeCycle implements Filter
key = WebSocketUpgradeFilter.class.getName();
}
setToAttribute(ctx, key);
setToAttribute(config.getServletContext(), key);
factory.start();
}