@Override public void beforeStartApplication(Object object) { this.mockHttpSession = new MockHttpSession(); this.servletContextEvent = new MockServletContextEvent(); WebBeansContext webBeansContext = getWebBeansContext(); ContextsService contextsService = webBeansContext.getContextsService(); contextsService.startContext(RequestScoped.class, null); contextsService.startContext(SessionScoped.class, mockHttpSession); contextsService.startContext(ConversationScoped.class, null); contextsService.startContext(ApplicationScoped.class, this.servletContextEvent.getServletContext()); }
final ServletContextEvent sce = new MockServletContextEvent(); servletContextEvents.put(webAppInfo, sce);
@Override public void beforeStopApplication(Object endObject) { WebBeansContext webBeansContext = getWebBeansContext(); ContextsService contextsService = webBeansContext.getContextsService(); contextsService.endContext(RequestScoped.class, null); contextsService.endContext(SessionScoped.class, this.mockHttpSession); contextsService.endContext(ConversationScoped.class, null); contextsService.endContext(ApplicationScoped.class, this.servletContextEvent.getServletContext()); //Comment out for OWB-502 //ContextFactory.cleanUpContextFactory(); // clean up the EL caches after each request ELContextStore elStore = ELContextStore.getInstance(false); if (elStore != null) { elStore.destroyELContextStore(); } }
final ServletContextEvent sce = component == null ? new MockServletContextEvent() : new ServletContextEvent(new LightServletContext(component, webContext.getClassLoader())); servletContextEvents.put(webAppInfo, sce);