List of usage examples for javax.servlet ServletContextEvent getServletContext
public ServletContext getServletContext()
From source file:org.firstopen.custom.event.agent.Initializer.java
public void contextDestroyed(ServletContextEvent event) { ServletContext servletContext = event.getServletContext(); try {/*from ww w . ja v a2 s. c o m*/ EventMonitorBean eventMonitorBean = (EventMonitorBean) servletContext .getAttribute(Constants.EVENT_MONITOR_KEY); if (eventMonitorBean != null) eventMonitorBean.shutdown(); event.getServletContext().log("Context Destroyed, eventMonitorBean shutdown complete."); } catch (InfrastructureException e) { log.error("unable to shutdown EventMonitorBean", e); } }
From source file:org.mobicents.servlet.sip.pbx.PbxListener.java
public void contextDestroyed(ServletContextEvent event) { LocationService locationService = (LocationService) event.getServletContext() .getAttribute(Constants.LOCATION_SERVICE); if (locationService != null) { try {/*from ww w. j ava 2s .c o m*/ locationService.stop(); } catch (Exception e) { } } }
From source file:org.firstopen.custom.event.agent.Initializer.java
public void contextInitialized(ServletContextEvent event) { ServletContext servletContext = event.getServletContext(); log.debug("Initializing Singularity..."); try {// w w w . j a v a2 s.c om servletContext.setAttribute(Constants.EVENT_MONITOR_KEY, new EventMonitorBean()); log.debug("Initialization complete..."); } catch (InfrastructureException e) { log.error("unable to initialize context", e); } }
From source file:org.excalibur.service.deployment.server.context.ApplicationServletContextListener.java
@Override public void contextDestroyed(ServletContextEvent sce) { ApplicationContext applicationContext = (ApplicationContext) sce.getServletContext() .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE); try {/* ww w .jav a 2 s . c om*/ applicationContext.getBean(Overlay.class).leave(); } catch (BeansException | OverlayException e) { LOG.error("Error on leaving the overlay [{}]", e.getMessage(), e); } }
From source file:com.ning.metrics.action.binder.modules.SetupServer.java
/** * This method can be called by classes extending SetupServer to retrieve * the actual injector. This requires some inside knowledge on where it is * stored, but the actual key is not visible outside the guice packages. *//*from w w w.j a v a2 s . co m*/ Injector injector(final ServletContextEvent event) { return (Injector) event.getServletContext().getAttribute(Injector.class.getName()); }
From source file:de.ingrid.iplug.web.DatatypeContextListener.java
public void contextInitialized(ServletContextEvent servletcontextevent) { ServletContext servletContext = servletcontextevent.getServletContext(); String realPathToDatatypes = servletContext.getRealPath(DATA_TYPES); IDataTypeProvider dataTypeProvider = new DataTypeProvider(new File(realPathToDatatypes), new DataTypeEditor()); BeanFactory beanFactory = (BeanFactory) servletContext.getAttribute("beanFactory"); try {/*from ww w.j av a 2s . c o m*/ beanFactory.addBean("dataTypeProvider", dataTypeProvider); } catch (IOException e) { LOG.error("can not add plugdescription", e); } }
From source file:org.mobicents.servlet.sip.example.InitializationListener.java
public void contextInitialized(ServletContextEvent servletContextEvent) { ServletContext servletContext = servletContextEvent.getServletContext(); File tempWriteDir = (File) servletContext.getAttribute("javax.servlet.context.tempdir"); servletContext.setAttribute("audioFilePath", FILE_PROTOCOL + tempWriteDir.getAbsolutePath() + File.separatorChar); // map acting as a registrar servletContext.setAttribute("registeredUsersMap", new HashMap<String, String>()); }
From source file:gov.nih.nci.cabig.caaers.web.rule.ContextListener.java
public void contextInitialized(ServletContextEvent servletContextEvent) { RuleUi ruleUi = load("rules-ui.xml"); servletContextEvent.getServletContext().setAttribute("ruleUi-general", ruleUi); ruleUi = load("rules-ui-safety-monitoring.xml"); servletContextEvent.getServletContext().setAttribute("ruleUi-safety", ruleUi); }
From source file:com.excilys.ebi.spring.dbunit.servlet.DataLoaderListener.java
@Override public void contextInitialized(ServletContextEvent sce) { context = getWebApplicationContext(sce.getServletContext()); try {//from w w w . j a v a2s .c o m configuration = configurationProcessor.getConfiguration(context); dataLoader.execute(context, configuration, Phase.SETUP); } catch (Exception e) { LOGGER.error("Error while initializing DbUnit data", e); throw new ExceptionInInitializerError(e); } }
From source file:net.sourceforge.vulcan.web.VulcanContextListener.java
public void contextDestroyed(ServletContextEvent event) { final ServletContext context = event.getServletContext(); context.removeAttribute(Keys.STATE_MANAGER); context.removeAttribute(Keys.EVENT_POOL); if (stateManager == null) { // startup probably failed. return;//from w ww.j a v a 2 s. c o m } try { stateManager.shutdown(); } catch (Exception e) { context.log("Error during shutdown of stateManager", e); } }