List of usage examples for javax.servlet ServletContextEvent getServletContext
public ServletContext getServletContext()
From source file:com.workplacesystems.queuj.sample.seam.QJListener.java
@Override public void contextInitialized(ServletContextEvent sce) { String log4jXml = sce.getServletContext().getRealPath("/WEB-INF/log4j.xml"); DOMConfigurator.configureAndWatch(log4jXml); log.info("Starting queujSeamSample"); }
From source file:gov.nih.nci.cabig.caaers.web.rule.ContextListener.java
public void contextDestroyed(ServletContextEvent servletContextEvent) { servletContextEvent.getServletContext().removeAttribute("ruleUi-general"); servletContextEvent.getServletContext().removeAttribute("ruleUi-safety"); }
From source file:edu.cornell.mannlib.vitro.webapp.servlet.setup.JenaPersistentDataSourceSetup.java
@Override public void contextInitialized(ServletContextEvent sce) { ServletContext ctx = sce.getServletContext(); StartupStatus ss = StartupStatus.getBean(ctx); // we do not want to fetch imports when we wrap Models in OntModels OntDocumentManager.getInstance().setProcessImports(false); DataSource bds = makeDataSourceFromConfigurationProperties(ctx); setApplicationDataSource(bds, ctx);//w w w . j a va2 s. co m }
From source file:com.predic8.membrane.servlet.MembraneServletContextListener.java
private String getProxiesXmlLocation(ServletContextEvent sce) { return sce.getServletContext().getInitParameter("proxiesXml"); }
From source file:com.scf.web.context.spring.ProjectLog4jConfigListener.java
@Override public void contextInitialized(ServletContextEvent event) { String outLink = event.getServletContext().getInitParameter(LOG4J_OUT_LINK_FILE); if (outLink != null) { event.getServletContext().log("Looked a out link log4j file: " + outLink); File file = new File(outLink); if (file.exists()) { ProjectLog4jWebConfigurer.initLogging(event.getServletContext(), outLink); } else {/* w w w .j av a 2 s.c o m*/ super.contextInitialized(event); } } else { super.contextInitialized(event); } }
From source file:org.grails.jaxrs.web.JaxrsListener.java
public void contextDestroyed(ServletContextEvent event) { getRequiredJaxrsContext(event.getServletContext()).destroy(); }
From source file:org.bytesoft.openjtcc.supports.spring.web.TransactionResourceAdapterListener.java
public void contextDestroyed(ServletContextEvent event) { ServletContext servletContext = event.getServletContext(); WebApplicationContext applicationContext = WebApplicationContextUtils .getRequiredWebApplicationContext(servletContext); ResourceAdapter resourceAdapter = (ResourceAdapter) applicationContext.getBean(ResourceAdapter.class); resourceAdapter.stop();//from w ww . java2 s . co m }
From source file:org.infoscoop.migration.ISMigrationListener.java
@Override public void contextInitialized(ServletContextEvent event) { String defaultSchema = event.getServletContext().getInitParameter("liquibase.schema.default"); if (defaultSchema == null || StringUtils.isEmpty(defaultSchema)) { System.setProperty(DEFAULT_SCHEMA_NAME_WITH_DOT, ""); System.setProperty(DEFAULT_SCHEMA_NAME, ""); } else {/*from ww w .j a va 2s .com*/ System.setProperty(DEFAULT_SCHEMA_NAME_WITH_DOT, defaultSchema + "."); System.setProperty(DEFAULT_SCHEMA_NAME, defaultSchema); } super.contextInitialized(event); }
From source file:org.osaf.cosmo.ui.config.ConfigurationListener.java
/** * Gets the configurer from the// w ww.j a v a 2s . c o m * {@link org.springframework.web.context.WebApplicationContext} * and directs it to configure the servlet context. */ public void contextInitialized(ServletContextEvent sce) { ServletContext sc = sce.getServletContext(); WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(sc); // load application configuration ServletContextConfigurer scc = (ServletContextConfigurer) wac.getBean(BEAN_SERVLET_CONTEXT_CONFIGURER, ServletContextConfigurer.class); scc.configure(sc); }
From source file:ContextLogger.java
public void contextInitialized(ServletContextEvent sce) { ServletContext context = sce.getServletContext(); String realPath = context.getRealPath("/"); String fileSep = System.getProperty("file.separator"); if (realPath != null && (!realPath.endsWith(fileSep))) realPath = realPath + fileSep;// ww w . j a va 2 s . c om //Initialize logger here: PropertyConfigurator.configure(realPath + "WEB-INF/classes/" + context.getInitParameter("logger-config")); log = Logger.getLogger(ContextLogger.class); String name = context.getServletContextName(); //log request about servlet context being initialized log.info("ServletContext ready: " + (name == null ? "" : name)); }