List of usage examples for javax.servlet ServletContextEvent getServletContext
public ServletContext getServletContext()
From source file:au.gov.ansto.bragg.nbi.restlet.fileupload.servlet.FileCleanerCleanup.java
/** * Called when the web application is being destroyed. * Calls {@link FileCleaningTracker#exitWhenFinished()}. * * @param sce The servlet context, used for calling * {@link #getFileCleaningTracker(ServletContext)}. *///from w ww . ja va2 s. c o m public void contextDestroyed(ServletContextEvent sce) { getFileCleaningTracker(sce.getServletContext()).exitWhenFinished(); }
From source file:org.acoustid.server.ApplicationContextListener.java
@Override public void contextDestroyed(ServletContextEvent event) { ServletContext servletContext = event.getServletContext(); Injector injector = (Injector) servletContext.getAttribute(INJECTOR_ATTRIBUTE_NAME); if (injector == null) { logger.warn("Injector not found"); return;//www .ja v a2 s. c o m } servletContext.removeAttribute(INJECTOR_ATTRIBUTE_NAME); ApplicationContext context = injector.getInstance(ApplicationContext.class); logger.debug("Closing application context " + context); context.close(); }
From source file:org.acoustid.server.ApplicationContextListener.java
@Override public void contextInitialized(ServletContextEvent event) { ServletContext servletContext = event.getServletContext(); String configFileName = servletContext.getInitParameter("config"); logger.info("Loading configuration from " + configFileName); XMLConfiguration config;/*from w w w.ja va2s . c o m*/ try { config = new XMLConfiguration(configFileName); } catch (ConfigurationException ex) { throw new RuntimeException("Couldn't load configuration file", ex); } Injector injector = Guice.createInjector(new ServerModule(config)); logger.debug("Setting injector"); servletContext.setAttribute(INJECTOR_ATTRIBUTE_NAME, injector); }
From source file:org.grails.jaxrs.web.JaxrsListener.java
public void contextInitialized(ServletContextEvent event) { JaxrsContext jaxrsContext = getRequiredJaxrsContext(event.getServletContext()); jaxrsContext.setJaxrsServletContext(event.getServletContext()); try {/* w w w . j a v a2 s. co m*/ jaxrsContext.init(); } catch (ServletException e) { LOG.error("Initialization of JAX-RS context failed", e); } }
From source file:com.baidu.terminator.manager.common.SpringInit.java
public void contextInitialized(ServletContextEvent event) { context = WebApplicationContextUtils.getWebApplicationContext(event.getServletContext()); LinkControlService linkControlService = (LinkControlService) context.getBean("linkControlService"); linkControlService.recoveryLink();//from w ww .j a v a2 s.com }
From source file:jease.cms.web.servlet.JeaseServletListener.java
public void contextInitialized(ServletContextEvent sce) { ServletContext context = sce.getServletContext(); initSystemProperties(context);// ww w .j av a2s . c om initLocale(context); initDatabase(context); initTimer(context); }
From source file:org.unitedinternet.cosmo.db.DbListener.java
/** * Resolves dependencies using the Spring <code>WebApplicationContext</code> and performs startup maintenance tasks. *//*from ww w. j av a 2 s .c o m*/ @SuppressWarnings("unchecked") public void contextInitialized(ServletContextEvent sce) { ServletContext sc = sce.getServletContext(); WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(sc); DbInitializer initializer = beanForName(BEAN_DB_INITIALIZER, wac, DbInitializer.class); initializer.initialize(); delegates = beanForName(DELEGATES_BEAN_NAME, wac, List.class); for (ServletContextListenerDelegate delegate : delegates) { delegate.contextInitialized(sce); } }
From source file:com.github.glue.mvc.guice.GuiceConfigListener.java
@Override public void contextDestroyed(ServletContextEvent servletContextEvent) { ServletContext servletContext = servletContextEvent.getServletContext(); GuiceContainer guiceContainer = (GuiceContainer) servletContext.getAttribute(IOCCONTAINER); servletContext.removeAttribute(IOCCONTAINER); super.contextDestroyed(servletContextEvent); }
From source file:com.netspective.sparx.util.ApplicationEventsListener.java
public void contextInitialized(ServletContextEvent event) { log.trace("Init context for " + event.getServletContext().getServletContextName()); }
From source file:de.ingrid.iplug.web.PlugdescriptionContextListener.java
public void contextInitialized(ServletContextEvent servletcontextevent) { ServletContext servletContext = servletcontextevent.getServletContext(); String pdFile = servletContext.getInitParameter("plugdescription.xml"); BeanFactory beanFactory = (BeanFactory) servletContext.getAttribute("beanFactory"); try {/* www.j a v a 2 s . co m*/ beanFactory.addBean("pd_file", new File(pdFile)); } catch (IOException e) { LOG.error("can not add plugdescription", e); } }