423361 Ensure ServletContainerInitializers called before injecting Listeners
This commit is contained in:
parent
1731e0c69a
commit
2d3d912173
|
@ -23,6 +23,7 @@ import java.util.Set;
|
|||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.eclipse.jetty.plus.annotation.ContainerInitializer;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.util.ConcurrentHashSet;
|
||||
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
||||
import org.eclipse.jetty.util.log.Log;
|
||||
|
@ -36,11 +37,10 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
|||
* Call the onStartup() method on all ServletContainerInitializers, after having
|
||||
* found all applicable classes (if any) to pass in as args.
|
||||
*/
|
||||
public class ServletContainerInitializersStarter extends AbstractLifeCycle
|
||||
public class ServletContainerInitializersStarter extends AbstractLifeCycle implements ServletContextHandler.ServletContainerInitializerCaller
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(ServletContainerInitializersStarter.class);
|
||||
WebAppContext _context;
|
||||
|
||||
|
||||
/**
|
||||
* @param context
|
||||
|
|
|
@ -35,6 +35,7 @@ import javax.servlet.Filter;
|
|||
import javax.servlet.FilterRegistration;
|
||||
import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletContainerInitializer;
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
@ -62,6 +63,7 @@ import org.eclipse.jetty.server.session.SessionHandler;
|
|||
import org.eclipse.jetty.servlet.BaseHolder.Source;
|
||||
import org.eclipse.jetty.util.annotation.ManagedAttribute;
|
||||
import org.eclipse.jetty.util.annotation.ManagedObject;
|
||||
import org.eclipse.jetty.util.component.LifeCycle;
|
||||
|
||||
|
||||
/* ------------------------------------------------------------ */
|
||||
|
@ -82,6 +84,8 @@ public class ServletContextHandler extends ContextHandler
|
|||
public final static int SECURITY=2;
|
||||
public final static int NO_SESSIONS=0;
|
||||
public final static int NO_SECURITY=0;
|
||||
|
||||
public interface ServletContainerInitializerCaller extends LifeCycle {};
|
||||
|
||||
protected final List<Decorator> _decorators= new ArrayList<>();
|
||||
protected Class<? extends SecurityHandler> _defaultSecurityHandlerClass=org.eclipse.jetty.security.ConstraintSecurityHandler.class;
|
||||
|
@ -267,6 +271,9 @@ public class ServletContextHandler extends ContextHandler
|
|||
@Override
|
||||
protected void startContext() throws Exception
|
||||
{
|
||||
ServletContainerInitializerCaller sciBean = getBean(ServletContainerInitializerCaller.class);
|
||||
if (sciBean!=null)
|
||||
sciBean.start();
|
||||
|
||||
if (_servletHandler != null)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue