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.scf.web.context.BeforeSpringContextListener.java

/**
 *
 * @param sce//from   w  ww  .j a v a 2s.c  om
 * @throws Exception
 */
private void initRootResource(ServletContextEvent sce) {
    String rootInitClass = sce.getServletContext().getInitParameter(ResourceInitor.ROOT_RESOURCE_CLASS_PARAM);
    if (rootInitClass != null) {
        _logger.info("Fined project root config param '" + rootInitClass + "', initing.");
        IBootstartupInitialization initor = (IBootstartupInitialization) ClassUtilies
                .newInstance(rootInitClass);
        ResourceInitor.init(initor);
        _logger.info("Project root config param inited. ");
    } else {
        _logger.warn("Cann't find project root config param.");
    }
}

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

/**
 * Close the root web application context.
 *//*w w w. j a v a2  s .  c o m*/
public void contextDestroyed(ServletContextEvent event) {
    super.contextDestroyed(event);

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

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

From source file:org.jasig.springframework.web.portlet.context.PortletContextLoaderListener.java

@Override
public void contextDestroyed(ServletContextEvent sce) {
    //destroy the root portlet app context
    final ServletContext servletContext = sce.getServletContext();
    contextLoader.closeWebApplicationContext(servletContext);

    servletContext//from   ww w. j a v  a2s . c  om
            .removeAttribute(PortletApplicationContextUtils2.ROOT_PORTLET_APPLICATION_CONTEXT_LOADER_ATTRIBUTE);
    contextLoader = null;
}

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

/** {@inheritDoc} */
@Override//  ww w . j  ava 2s .com
public void contextInitialized(ServletContextEvent sce) {
    ServletContext context = sce.getServletContext();
    context.log("WebGoat is starting");
    setApplicationVariables(context);
    context.log("Adding extra mappings for lessions");

    loadPlugins(sce);
    loadServlets(sce);
}

From source file:ca.unx.template.config.WebAppInitializer.java

@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
    try {//from  ww  w  . ja  v a  2  s  .  co m
        onStartup(servletContextEvent.getServletContext());
    } catch (ServletException e) {
        logger.error("Failed to initialize web application", e);
        System.exit(0);
    }
}

From source file:se.vgregion.webbisar.web.FtpServerListener.java

public void contextDestroyed(ServletContextEvent sce) {
    LOGGER.info("Stopping FtpServer");

    FtpServer server = (FtpServer) sce.getServletContext().getAttribute(FTPSERVER_CONTEXT_NAME);

    if (server != null) {
        server.stop();/*from w  w w.j  a  v  a2 s. co  m*/

        sce.getServletContext().removeAttribute(FTPSERVER_CONTEXT_NAME);

        LOGGER.info("FtpServer stopped");
    } else {
        LOGGER.info("No running FtpServer found");
    }

}

From source file:be.fedict.eid.dss.webapp.StartupServletContextListener.java

private void initDocumentServices(ServletContextEvent event) {

    ServletContext servletContext = event.getServletContext();
    Map<String, String> documentServiceClassNames = this.servicesManager.getDocumentServiceClassNames();
    servletContext.setAttribute(DOCUMENT_SERVICES_CONTEXT_ATTRIBUTE, documentServiceClassNames);
}

From source file:be.fedict.eid.dss.ws.ServiceConsumerServletContextListener.java

public void contextInitialized(ServletContextEvent event) {

    LOG.debug("context initialized");
    ServletContext servletContext = event.getServletContext();

    LOG.debug("SignatureVerificationService ref available: " + (null != this.signatureVerificationService));
    servletContext.setAttribute(SignatureVerificationService.class.getName(),
            this.signatureVerificationService);

    LOG.debug("DocumentService ref available: " + (null != this.documentService));
    servletContext.setAttribute(DocumentService.class.getName(), this.documentService);
}

From source file:com.lyh.licenseworkflow.web.listener.StartupListener.java

public void contextInitialized(ServletContextEvent servletContextEvent) {
    WebApplicationContext ctx = WebApplicationContextUtils
            .getWebApplicationContext(servletContextEvent.getServletContext());
    ServerBeanFactory.setAppContext(ctx);
    ServerBeanFactory.setServletContext(servletContextEvent.getServletContext());
    //??/*from  w ww . j ava2s  .c  o m*/
    ServerBeanFactory.initModules();
    logger.info("LICENSEWORKFLOW Server [" + Version.getInstance().getSvnTag() + ".GA (build: SVNTag="
            + Version.getInstance().getSvnTag() + " date=" + Version.getInstance().getBuildDate()
            + ")] has started...");
}

From source file:be.fedict.trust.xkms2.ServiceConsumerServletContextListener.java

@SuppressWarnings("unchecked")
public void contextInitialized(ServletContextEvent event) {
    LOG.debug("context initialized");
    ServletContext servletContext = event.getServletContext();
    Enumeration<String> attributeNames = servletContext.getAttributeNames();
    while (attributeNames.hasMoreElements()) {
        String attributeName = attributeNames.nextElement();
        LOG.debug("servlet context attribute: " + attributeName);
    }/*from w w  w . j ava 2s  . co m*/
    LOG.debug("trust service injected: " + (null != this.trustService));
    /*
     * Via the Servlet Context we can make the Trust Service EJB3 reference
     * available to the JAW-WS endpoints.
     */
    servletContext.setAttribute(TrustService.class.getName(), this.trustService);
}