Skip to content

Commit

Permalink
Fixing merge 9.2.x -> 9.3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
joakime committed Nov 17, 2016
1 parent bfadca4 commit 7930a3d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
Expand Up @@ -37,7 +37,6 @@
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;
Expand Down Expand Up @@ -201,20 +200,8 @@ public void onStartup(Set<Class<?>> c, ServletContext context) throws ServletExc
// 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())
Expand Down
Expand Up @@ -221,9 +221,13 @@ public BatchMode getBatchMode()
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();
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -292,6 +292,7 @@ public void init(FilterConfig config) throws ServletException
{
factory = new WebSocketServerFactory(policy, bufferPool);
}
factory.init(config.getServletContext());
addBean(factory, true);

// TODO: Policy isn't from attributes
Expand Down Expand Up @@ -327,7 +328,7 @@ public void init(FilterConfig config) throws ServletException
key = WebSocketUpgradeFilter.class.getName();
}

setToAttribute(ctx, key);
setToAttribute(config.getServletContext(), key);

factory.start();
}
Expand Down

0 comments on commit 7930a3d

Please sign in to comment.