Example usage for javax.servlet ServletContextEvent getServletContext

List of usage examples for javax.servlet ServletContextEvent getServletContext

Introduction

In this page you can find the example usage for javax.servlet ServletContextEvent getServletContext.

Prototype

public ServletContext getServletContext() 

Source Link

Document

Return the ServletContext that changed.

Usage

From source file:org.owasp.webgoat.application.WebGoatServletListener.java

private void loadPlugins(ServletContextEvent sce) {
    String pluginPath = sce.getServletContext().getRealPath("plugin_lessons");
    String targetPath = sce.getServletContext().getRealPath("plugin_extracted");
    new PluginsLoader(Paths.get(pluginPath), Paths.get(targetPath)).loadPlugins();
}

From source file:com.apdplat.platform.spring.APDPlatContextLoaderListener.java

public void contextDestroyed(ServletContextEvent event) {
    cleanupAttributes(event.getServletContext());
}

From source file:edu.cornell.mannlib.vitro.webapp.config.ConfigurationPropertiesSmokeTests.java

@Override
public void contextInitialized(ServletContextEvent sce) {
    ServletContext ctx = sce.getServletContext();
    ConfigurationProperties props = ConfigurationProperties.getBean(ctx);
    StartupStatus ss = StartupStatus.getBean(ctx);

    checkDefaultNamespace(ctx, props, ss);
    checkLanguages(props, ss);/* w  w  w  .j ava 2 s .c om*/
}

From source file:ar.com.jrules.core.listener.JRuleListener.java

public void contextInitialized(ServletContextEvent servletContextEvent) {
    log.debug("start initialize jRules");

    ServletContext ctx = servletContextEvent.getServletContext();
    WebApplicationContext springContext = WebApplicationContextUtils.getWebApplicationContext(ctx);

    LoadJRules loadJRules = new LoadJRules(springContext);

    loadJRules.loadJRules();//from  w w  w .  ja  v  a 2 s . c om

    log.debug("end initialize jRules");
}

From source file:com.mycompany.hcsparta_web.StartListener.java

@Override
public void contextInitialized(ServletContextEvent ev) {
    log.info("webov aplikace inicializovna");
    ServletContext servletContext = ev.getServletContext();
    ApplicationContext springContext = new AnnotationConfigApplicationContext(SpringConfig.class);

    servletContext.setAttribute("playerManager",
            springContext.getBean("playerManager", PlayerManagerImpl.class));
    PlayerManagerImpl pl = (PlayerManagerImpl) servletContext.getAttribute("playerManager");
    pl.initFunction();//from  w w w.  j  a v a 2  s .c  o m

    servletContext.setAttribute("matchManager", springContext.getBean("matchManager", MatchManagerImpl.class));

    log.info("vytvoeny manaery");

}

From source file:org.red5.logging.ContextLoggingListener.java

public void contextDestroyed(ServletContextEvent event) {
    ServletContext servletContext = event.getServletContext();
    LoggerContext context = (LoggerContext) servletContext
            .getAttribute(Red5LoggerFactory.LOGGER_CONTEXT_ATTRIBUTE);
    if (context != null) {
        Logger logger = context.getLogger(Logger.ROOT_LOGGER_NAME);
        logger.debug("Shutting down context {}", context.getName());
        context.reset();/*  w  w w.  ja v a2s .com*/
        context.stop();
    } else {
        System.err.printf("No logger context found for %s%n", event.getServletContext().getContextPath());
    }
}

From source file:nl.b3p.viewer.admin.monitoring.GeoServiceMonitoringListener.java

@Override
public void contextInitialized(ServletContextEvent sce) {
    this.context = sce.getServletContext();

    String interval = context.getInitParameter(PARAM_INTERVAL);
    if (interval == null || "-1".equals(interval)) {
        return;/*www .ja  v a  2 s  . co  m*/
    }

    try {
        Mailer.getMailSession();
    } catch (Exception e) {
        log.error(
                "Error getting mail session, monitoring disabled! Please configure the JNDI JavaMail Session resource correctly.",
                e);
        return;
    }

    try {
        setupQuartz();
    } catch (Exception e) {
        log.error("Error setting up Quartz, monitoring disabled!", e);
        return;
    }
}

From source file:org.apache.tiles.web.startup.TilesListener.java

/**
 * Initialize the TilesContainer and place it
 * into service./*from w w  w  .j ava 2s . c o m*/
 *
 * @param event The intercepted event.
 */
public void contextInitialized(ServletContextEvent event) {
    ServletContext servletContext = event.getServletContext();
    initializer.initialize(new ServletTilesApplicationContext(servletContext));
}

From source file:org.guzz.web.context.spring.GuzzWithSpringContextLoaderListener.java

public void contextInitialized(ServletContextEvent event) {
    ServletContext sc = event.getServletContext();

    //?spring/*from ww  w .ja va2  s .c o  m*/
    if (springContext == null) {
        springContext = new org.springframework.web.context.ContextLoaderListener();
        springContext.contextInitialized(event);

        ApplicationContext applicationContext = org.springframework.web.context.ContextLoader
                .getCurrentWebApplicationContext();
        GuzzContextImpl gc = (GuzzContextImpl) applicationContext.getBean("guzzContext");

        if (gc == null) {
            throw new GuzzException("spring bean [guzzContext] not found.");
        }

        //spring???
        SpringExtendedBeanFactory ebf = new SpringExtendedBeanFactory(applicationContext);
        gc.setExtendedBeanFactory(ebf);

        //?guzz
        if (context == null) {
            context = new ContextLoader();
            try {
                context.initGuzzContext(sc, gc);
            } catch (Exception e) {
                log.error("can't start guzz.", e);
                context = null;
                onLoadError(e);
            }
        }
    }
}

From source file:com.icanft.common.startup.ContextInit.java

/**
 * ?DI//from w  w w .  j  ava2s.c  o m
 * 
 * @param event ServletContextEvent
 */
public void contextDestroyed(ServletContextEvent event) {
    ServletContext servletContext = event.getServletContext();
    log.info("?Portlet");

    log.info("??Portlet");
    super.contextDestroyed(event);
}