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:com.norteksoft.security.web.listener.SecurityContextListener.java

public void contextInitialized(ServletContextEvent event) {
    ServletContext context = event.getServletContext();
    systemCode = context.getInitParameter("systemCode");
    checkLicense(context);//from   www  .j av  a2 s.  c  o m
}

From source file:org.glimpse.server.LogConfigurator.java

@Override
public void contextInitialized(ServletContextEvent sce) {
    ServletContext servletContext = sce.getServletContext();

    String confDirPath = System.getProperty("org.glimpse.conf.dir");
    if (StringUtils.isEmpty(confDirPath)) {
        confDirPath = servletContext.getRealPath("/WEB-INF/conf");
    }/*from w ww  . j a v  a2 s . c  o  m*/
    File configurationDirectory = new File(confDirPath);

    File logConfig = new File(configurationDirectory, "log4j.properties");

    if (logConfig.exists()) {
        LogManager.resetConfiguration();
        PropertyConfigurator.configure(logConfig.getAbsolutePath());
    }
}

From source file:org.guzz.web.context.ContextLoaderListener.java

public void contextInitialized(ServletContextEvent event) {
    ServletContext sc = event.getServletContext();
    if (context == null) {
        context = new ContextLoader();
        try {/*w  ww  .  j a  v  a2s. c  om*/
            context.initGuzzContext(sc);
        } catch (Exception e) {
            log.error(e);
            context = null;
            onLoadError(e);
        }
    }

}

From source file:org.nuxeo.ecm.web.embedded.NuxeoEmbeddedLoader.java

@Override
public void contextInitialized(ServletContextEvent sce) {
    fb = loadRuntime(sce.getServletContext());
    instance = this;
}

From source file:org.sakaiproject.util.SakaiContextLoaderListener.java

/**
 * Close the root web application context.
 *//*from   w  w w.j  a va 2 s. c  om*/
@Override
public void contextDestroyed(ServletContextEvent event) {
    closeWebApplicationContext(event.getServletContext());
    //ContextCleanupListener.cleanupAttributes(event.getServletContext());

    log.info("Destroying Components in " + event.getServletContext().getServletContextName());

    // decrement the count of children for the component manager
    ((SpringCompMgr) ComponentManager.getInstance()).removeChildAc();
}

From source file:edu.cornell.mannlib.vitro.webapp.auth.policy.setup.CommonPolicyFamilySetup.java

@Override
public void contextInitialized(ServletContextEvent sce) {
    ServletContext ctx = sce.getServletContext();

    if (AbortStartup.isStartupAborted(ctx)) {
        return;/*  w  ww.  j a  va  2  s.  co  m*/
    }

    try {
        ServletPolicyList.addPolicy(ctx, new DisplayRestrictedDataByRoleLevelPolicy(ctx));
        ServletPolicyList.addPolicy(ctx, new DisplayRestrictedDataToSelfPolicy(ctx));
        ServletPolicyList.addPolicy(ctx, new EditRestrictedDataByRoleLevelPolicy(ctx));
        ServletPolicyList.addPolicy(ctx, new UseRestrictedPagesByRoleLevelPolicy());

        ServletPolicyList.addPolicy(ctx, new SelfEditingPolicy(ctx));

        // This factory creates Identifiers for all of the above policies.
        CommonIdentifierBundleFactory factory = new CommonIdentifierBundleFactory(ctx);

        ActiveIdentifierBundleFactories.addFactory(sce, factory);
    } catch (Exception e) {
        log.error("could not run " + this.getClass().getSimpleName() + ": " + e);
        AbortStartup.abortStartup(ctx);
        throw new RuntimeException(e);
    }
}

From source file:com.krawler.common.listeners.LocaleResolverBuilder.java

@Override
public void contextInitialized(ServletContextEvent sce) {
    ServletContext context = sce.getServletContext();
    String clName = context.getInitParameter(LOCALE_RESOLVER_CLASS_NAME_ATTR);
    String baseName = context.getInitParameter(MESSAGE_SOURCE_BASENAME_ATTR);
    try {//from w  w w .  j a  va2 s  .  c om
        LocaleResolver obj = (LocaleResolver) Class.forName(clName).newInstance();
        context.setAttribute(LocaleUtils.LOCALE_RESOLVER_NAME, obj);
        if (MessageSourceProxy.getMessageSource() == null && baseName != null) {
            MessageSourceProxy.setMessageSource(createMessageSource(baseName.split(",")));
        }
    } catch (Exception ex) {
        log.debug(ex.getMessage());
    }
}

From source file:org.josso.gateway.signon.SSOContextListener.java

public void contextDestroyed(ServletContextEvent event) {
    SSOGateway g = (SSOGateway) event.getServletContext().getAttribute(KEY_JOSSO_GATEWAY);
    if (g != null) {
        g.destroy();//from  ww w  .  ja  va 2s . c  o m
    }

}

From source file:com.baidu.stqa.signet.web.common.spring.SpringInit.java

public void contextInitialized(ServletContextEvent event) {
    context = WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());
}

From source file:au.gov.ansto.bragg.nbi.restlet.fileupload.servlet.FileCleanerCleanup.java

/**
 * Called when the web application is initialized. Does
 * nothing.//from   w  ww  .  j a  v a 2 s .c o  m
 *
 * @param sce The servlet context, used for calling
 *   {@link #setFileCleaningTracker(ServletContext, FileCleaningTracker)}.
 */
public void contextInitialized(ServletContextEvent sce) {
    setFileCleaningTracker(sce.getServletContext(), new FileCleaningTracker());
}