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.library.bookarticlelibrary.WebAppInitializer.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 .ja va2s . c  o  m
    dispatcher.addMapping("/");
    dispatcher.addMapping("*.css");
    dispatcher.addMapping("*.js");
    dispatcher.addMapping("*.pdf");
    dispatcher.addMapping("*.json");
}

From source file:ch.thp.proto.spring.time.web.config.ServletAppInitializer.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 www  . j  a va2s  . c  om
    dispatcher.addMapping("/*");
}

From source file:com.zbum.example.springweb.initializer.WebInitializer.java

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);// w  w w  .j  a va2 s .com
    dispatcher.addMapping(MAPPING_URL);
}

From source file:ca.n4dev.dev.worktime.config.SpringAppInitializer.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));

    //servletContext.addFilter("springSecurityFilterChain", new DelegatingFilterProxy("springSecurityFilterChain")).addMappingForUrlPatterns(null, false, "/*");

    dispatcher.setLoadOnStartup(1);/*www .  j av a2s  . c o  m*/
    dispatcher.addMapping(MAPPING_URL);
}

From source file:org.jbr.commons.container.http.StandardWebAppInitializer.java

protected void createContextLoaderListener(final ServletContext servletContext,
        final WebApplicationContext rootContext) {
    servletContext.addListener(new ContextLoaderListener(rootContext));
}

From source file:com.adamjan.AppInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    XmlWebApplicationContext ctx = new XmlWebApplicationContext();
    servletContext.addListener(new ContextLoaderListener(ctx));
    servletContext.addListener(new ContextCleanupListener());
}

From source file:$.SpringAppInitializer.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  .c o  m*/
        dispatcher.addMapping(MAPPING_URL);
    }

From source file:org.efoe.poc.springws.provider.xmlbeans.initializer.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 ww w  .j av a 2 s  .co  m*/
    dispatcher.addMapping(MAPPING_URL);

    ServletRegistration.Dynamic ws = servletContext.addServlet("MessageDispatcherServlet",
            new MessageDispatcherServlet(context));
    ws.setInitParameter("transformWsdlLocations", "true");
    ws.addMapping("/services/*");
}

From source file:cz.muni.fi.pa165.rest.layer.Initializer.java

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

From source file:org.consultjr.mvc.core.config.ApplicationInitializer.java

@Override
public void onStartup(ServletContext servletContext) throws ServletException {
    WebApplicationContext context = getContext();
    servletContext.addListener(new ContextLoaderListener(context));
    servletContext.addListener(new ApplicationSessionListener());
    ServletRegistration.Dynamic dispatcher = servletContext.addServlet("DispatcherServlet",
            new DispatcherServlet(context));
    dispatcher.setLoadOnStartup(1);/*from  w ww.jav  a2s  .c om*/
    dispatcher.addMapping("/");
}