Example usage for javax.servlet ServletContext addListener

List of usage examples for javax.servlet ServletContext addListener

Introduction

In this page you can find the example usage for javax.servlet ServletContext addListener.

Prototype

public void addListener(Class<? extends EventListener> listenerClass);

Source Link

Document

Adds a listener of the given class type to this ServletContext.

Usage

From source file:com.adeptj.runtime.common.Servlets.java

public static void registerBridgeListeners(ServletContext servletContext) {
    servletContext.addListener(new BridgeServletContextAttributeListener());
    servletContext.addListener(new BridgeHttpSessionListener());
    servletContext.addListener(new BridgeHttpSessionIdListener());
    servletContext.addListener(new BridgeHttpSessionAttributeListener());
}

From source file:com.adeptj.runtime.common.Servlets.java

public static void registerListener(ServletContext servletContext, EventListener listener) {
    servletContext.addListener(listener);
}

From source file:com.kurento.kmf.spring.KurentoApplicationContextUtils.java

public static void registerKurentoServletContextListener(ServletContext ctx) {
    // Add listener for closing Kurento ApplicationContexts on container
    // shutdown/*from   w  ww .java  2  s  . co m*/

    if (ctx.getAttribute(KURENTO_SERVLET_CONTEXT_LISTENER_ATTRIBUTE_NAME) != null) {
        log.info("Kurento ServletContextListener already registered, we don't register it again ...");
        return;
    }
    log.info("Registering Kurento ServletContextListener ...");
    ctx.setAttribute(KURENTO_SERVLET_CONTEXT_LISTENER_ATTRIBUTE_NAME, "initialized");
    ctx.addListener(KurentoServletContextListener.class);
}

From source file:hwolf.showcase.Application.java

@Override
public void onStartup(ServletContext context) throws ServletException {

    context.addListener(new FileCleanerCleanup());
    context.addFilter("PrimeFaces FileUpload Filter", new FileUploadFilter()) //
            .addMappingForServletNames(null, false, "FacesServlet");

    context.addFilter("Browser Stats Filter", new UserAgentListener()) //
            .addMappingForUrlPatterns(null, false, "/push/chart.xhtml");
    Dynamic registration = context.addServlet("Push Servlet", new PushServlet());
    registration.setAsyncSupported(true);
    registration.addMapping("/primepush/*");
}

From source file:com.dshue.web.ApplicationInitializer.java

private void registerRequestContextListener(ServletContext servletContext) {
    servletContext.addListener(new RequestContextListener());
}

From source file:com.xumpy.security.SpringConfig.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    servletContext.addListener(new RequestContextListener());
    super.onStartup(servletContext);
}

From source file:fr.mycellar.configuration.JavaMelodyConfiguration.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    servletContext.addListener(new SessionListener());
}

From source file:com.rockagen.gnext.main.BootStrap.java

protected void addListeners(final ServletContext ctx) {
    ctx.addListener(new ContextLoaderListener(rootContext));
    Log4jConfigListener lcl = new Log4jConfigListener();
    ctx.addListener(lcl);/*w w  w  .ja  v  a  2  s  .c o m*/
}

From source file:org.akhikhl.examples.gretty.hellogretty.AppInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    WebApplicationContext context = getContext();
    servletContext.addListener(new ContextLoaderListener(context));
}

From source file:org.emmanuel.spring.chat.config.webxml.WebXml.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    WebApplicationContext context = getContext();
    servletContext.addListener(new ContextLoaderListener(context));
    ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet",
            new DispatcherServlet(context));
    dispatcher.setLoadOnStartup(1);/*from w  w w  .  j  a v  a2 s  .  com*/
    dispatcher.addMapping(MAPPING_URL);
}