400312 ServletContextListener.contextInitialized() is not called when added in ServletContainerInitializer.onStartup
This commit is contained in:
parent
a3400f0092
commit
caa0199efe
|
@ -224,10 +224,10 @@ public class AnnotationConfiguration extends AbstractConfiguration
|
|||
}
|
||||
|
||||
|
||||
//add a listener which will call the servletcontainerinitializers when appropriate
|
||||
//add a bean which will call the servletcontainerinitializers when appropriate
|
||||
ServletContainerInitializerListener listener = new ServletContainerInitializerListener();
|
||||
listener.setWebAppContext(context);
|
||||
context.addEventListener(listener);
|
||||
context.addBean(listener, true);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,12 +22,10 @@ import java.util.HashSet;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import javax.servlet.ServletContextListener;
|
||||
|
||||
import org.eclipse.jetty.annotations.AnnotationConfiguration;
|
||||
import org.eclipse.jetty.plus.annotation.ContainerInitializer;
|
||||
import org.eclipse.jetty.util.MultiMap;
|
||||
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.webapp.WebAppContext;
|
||||
|
@ -37,7 +35,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
|
|||
*
|
||||
*
|
||||
*/
|
||||
public class ServletContainerInitializerListener implements ServletContextListener
|
||||
public class ServletContainerInitializerListener extends AbstractLifeCycle
|
||||
{
|
||||
private static final Logger LOG = Log.getLogger(ServletContainerInitializerListener.class);
|
||||
protected WebAppContext _context = null;
|
||||
|
@ -48,10 +46,12 @@ public class ServletContainerInitializerListener implements ServletContextListen
|
|||
_context = context;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.servlet.ServletContextListener#contextInitialized(javax.servlet.ServletContextEvent)
|
||||
* Call the doStart method of the ServletContainerInitializers
|
||||
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
|
||||
*/
|
||||
public void contextInitialized(ServletContextEvent sce)
|
||||
public void doStart()
|
||||
{
|
||||
List<ContainerInitializer> initializers = (List<ContainerInitializer>)_context.getAttribute(AnnotationConfiguration.CONTAINER_INITIALIZERS);
|
||||
MultiMap classMap = (MultiMap)_context.getAttribute(AnnotationConfiguration.CLASS_INHERITANCE_MAP);
|
||||
|
@ -131,10 +131,12 @@ public class ServletContainerInitializerListener implements ServletContextListen
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @see javax.servlet.ServletContextListener#contextDestroyed(javax.servlet.ServletContextEvent)
|
||||
* Nothing to do for ServletContainerInitializers on stop
|
||||
* @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStop()
|
||||
*/
|
||||
public void contextDestroyed(ServletContextEvent sce)
|
||||
public void doStop()
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -2327,6 +2327,7 @@ public class ContextHandler extends ScopedHandler implements Attributes, Server.
|
|||
if (!_enabled)
|
||||
throw new UnsupportedOperationException();
|
||||
ContextHandler.this.addEventListener(t);
|
||||
ContextHandler.this.restrictEventListener(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue