@Override public void contextDestroyed(ServletContextEvent sce) { if (isOriginalListenerUsed) { // Do not shutdown Weld if org.jboss.weld.environment.servlet.Listener is registered return; } super.contextDestroyed(sce); lifecycle.destroy(sce.getServletContext()); }
@Override protected ServletListener delegate() { return lifecycle.getWeldListener(); }
@Override public void contextInitialized(ServletContextEvent sce) { ServletContext context = sce.getServletContext(); lifecycle = (WeldServletLifecycle) context.getAttribute(WeldServletLifecycle.INSTANCE_ATTRIBUTE_NAME); context.setAttribute(LISTENER_USED_ATTRIBUTE_NAME, Boolean.TRUE); if (Boolean.TRUE.equals(context.getAttribute(EnhancedListener.ENHANCED_LISTENER_USED_ATTRIBUTE_NAME))) { WeldServletLogger.LOG.enhancedListenerUsedForNotifications(); return; } WeldServletLogger.LOG.initializeWeldUsingServletContextListener(); for (Consumer<ServletContext> initAction : initActions) { initAction.accept(context); } lifecycle = new WeldServletLifecycle(); lifecycle.initialize(context); super.contextInitialized(sce); }
final CDI11Deployment deployment = createDeployment(context, bootstrap); Container container = findContainer(containerContext, dump); if (container == null) { WeldServletLogger.LOG.noSupportedServletContainerDetected();
container = checkContainers(ctx, dump, extContainers); if (container == null) { container = checkContainers(ctx, dump, Arrays.asList(TomcatContainer.INSTANCE, JettyContainer.INSTANCE, UndertowContainer.INSTANCE, GwtDevHostedModeContainer.INSTANCE));
@Override public void contextInitialized(ServletContextEvent sce) { ServletContext context = sce.getServletContext(); lifecycle = (WeldServletLifecycle) context.getAttribute(WeldServletLifecycle.INSTANCE_ATTRIBUTE_NAME); context.setAttribute(LISTENER_USED_ATTRIBUTE_NAME, Boolean.TRUE); if (Boolean.TRUE.equals(context.getAttribute(EnhancedListener.ENHANCED_LISTENER_USED_ATTRIBUTE_NAME))) { WeldServletLogger.LOG.enhancedListenerUsedForNotifications(); return; } WeldServletLogger.LOG.initializeWeldUsingServletContextListener(); for (Consumer<ServletContext> initAction : initActions) { initAction.accept(context); } lifecycle = new WeldServletLifecycle(); lifecycle.initialize(context); super.contextInitialized(sce); }
final CDI11Deployment deployment = createDeployment(context, bootstrap); Container container = findContainer(containerContext, dump); if (container == null) { WeldServletLogger.LOG.noSupportedServletContainerDetected();
container = checkContainers(ctx, dump, extContainers); if (container == null) { container = checkContainers(ctx, dump, Arrays.asList(TomcatContainer.INSTANCE, JettyContainer.INSTANCE, UndertowContainer.INSTANCE, GwtDevHostedModeContainer.INSTANCE));
@Override public void contextInitialized(ServletContextEvent sce) { ServletContext context = sce.getServletContext(); lifecycle = (WeldServletLifecycle) context.getAttribute(WeldServletLifecycle.INSTANCE_ATTRIBUTE_NAME); context.setAttribute(LISTENER_USED_ATTRIBUTE_NAME, Boolean.TRUE); if (Boolean.TRUE.equals(context.getAttribute(EnhancedListener.ENHANCED_LISTENER_USED_ATTRIBUTE_NAME))) { WeldServletLogger.LOG.enhancedListenerUsedForNotifications(); return; } WeldServletLogger.LOG.initializeWeldUsingServletContextListener(); for (Consumer<ServletContext> initAction : initActions) { initAction.accept(context); } lifecycle = new WeldServletLifecycle(); lifecycle.initialize(context); super.contextInitialized(sce); }
final CDI11Deployment deployment = createDeployment(context, bootstrap); Container container = findContainer(containerContext, dump); if (container == null) { WeldServletLogger.LOG.noSupportedServletContainerDetected();
@Override public void contextDestroyed(ServletContextEvent sce) { if (isOriginalListenerUsed) { // Do not shutdown Weld if org.jboss.weld.environment.servlet.Listener is registered return; } super.contextDestroyed(sce); lifecycle.destroy(sce.getServletContext()); }
@Override protected ServletListener delegate() { return lifecycle.getWeldListener(); }
container = checkContainers(ctx, dump, extContainers); if (container == null) { container = checkContainers(ctx, dump, Arrays.asList(TomcatContainer.INSTANCE, JettyContainer.INSTANCE, UndertowContainer.INSTANCE, GwtDevHostedModeContainer.INSTANCE));
@Override public void onStartup(Set<Class<?>> classes, ServletContext context) throws ServletException { WeldServletLogger.LOG.initializeWeldUsingServletContainerInitializer(); context.setAttribute(ENHANCED_LISTENER_USED_ATTRIBUTE_NAME, Boolean.TRUE); WeldServletLifecycle lifecycle = new WeldServletLifecycle(); // If not initialized properly, don't register itself as a listener if (lifecycle.initialize(context)) { this.lifecycle = lifecycle; context.setAttribute(WeldServletLifecycle.INSTANCE_ATTRIBUTE_NAME, lifecycle); context.addListener(this); super.contextInitialized(new ServletContextEvent(context)); } }
@Override public void contextDestroyed(ServletContextEvent sce) { if (isOriginalListenerUsed) { // Do not shutdown Weld if org.jboss.weld.environment.servlet.Listener is registered return; } super.contextDestroyed(sce); lifecycle.destroy(sce.getServletContext()); }
@Override protected ServletListener delegate() { return lifecycle.getWeldListener(); }
@Override public void onStartup(Set<Class<?>> classes, ServletContext context) throws ServletException { WeldServletLogger.LOG.initializeWeldUsingServletContainerInitializer(); context.setAttribute(ENHANCED_LISTENER_USED_ATTRIBUTE_NAME, Boolean.TRUE); WeldServletLifecycle lifecycle = new WeldServletLifecycle(); // If not initialized properly, don't register itself as a listener if (lifecycle.initialize(context)) { this.lifecycle = lifecycle; context.setAttribute(WeldServletLifecycle.INSTANCE_ATTRIBUTE_NAME, lifecycle); context.addListener(this); super.contextInitialized(new ServletContextEvent(context)); } }
@Override public void contextDestroyed(ServletContextEvent sce) { if (lifecycle == null) { if (!Boolean.TRUE.equals(sce.getServletContext().getAttribute(EnhancedListener.ENHANCED_LISTENER_USED_ATTRIBUTE_NAME))) { // This should never happen WeldServletLogger.LOG.noServletLifecycleToDestroy(); } return; } super.contextDestroyed(sce); lifecycle.destroy(sce.getServletContext()); }
@Override protected ServletListener delegate() { return lifecycle.getWeldListener(); }
@Override public void onStartup(Set<Class<?>> classes, ServletContext context) throws ServletException { WeldServletLogger.LOG.initializeWeldUsingServletContainerInitializer(); context.setAttribute(ENHANCED_LISTENER_USED_ATTRIBUTE_NAME, Boolean.TRUE); WeldServletLifecycle lifecycle = new WeldServletLifecycle(); // If not initialized properly, don't register itself as a listener if (lifecycle.initialize(context)) { this.lifecycle = lifecycle; context.setAttribute(WeldServletLifecycle.INSTANCE_ATTRIBUTE_NAME, lifecycle); context.addListener(this); super.contextInitialized(new ServletContextEvent(context)); } }