Examples of ContextLoaderListener


Examples of org.springframework.web.context.ContextLoaderListener

    }

    public void test() throws Exception {
        ContextHandler context = new ContextHandler();
        context.setContextPath("/test");
        context.setEventListeners(new EventListener[] {new ContextLoaderListener()});
        Map initParams = new HashMap();
        initParams.put("contextConfigLocation", "classpath:org/apache/servicemix/web/http/spring-web.xml");
        initParams.put("contextClass", XmlWebApplicationContext.class.getName());
        context.setInitParams(initParams);
        ServletHolder holder = new ServletHolder();
View Full Code Here

Examples of org.springframework.web.context.ContextLoaderListener

  @Override
  public void onStartup(ServletContext sc) throws ServletException {
    WebApplicationContext rootAppContext = createRootApplicationContext(sc);
    if (rootAppContext != null) {
      sc.addListener(new ContextLoaderListener(rootAppContext) {
        @Override
        public void contextInitialized(ServletContextEvent event) {
          // no-op because the application context is already initialized
        }
      });
View Full Code Here

Examples of org.springframework.web.context.ContextLoaderListener

    @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);
        dispatcher.addMapping(MAPPING_URL);
    }
View Full Code Here

Examples of org.springframework.web.context.ContextLoaderListener

        sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
                "classpath:/applicationContext-dao.xml, " +
                "classpath:/applicationContext-service.xml, " +
                "classpath:/applicationContext-resources.xml");

        springListener = new ContextLoaderListener();
        springListener.contextInitialized(new ServletContextEvent(sc));
        listener = new StartupListener();
    }
View Full Code Here

Examples of org.springframework.web.context.ContextLoaderListener

  private void registerListeners(ServletContext servletContext,
      AnnotationConfigWebApplicationContext root) {

    servletContext.addListener(new LoggingInitializerListener());
    servletContext.addListener(new ContextLoaderListener(root));
    servletContext.addListener(new RequestContextListener());
  }
View Full Code Here

Examples of org.springframework.web.context.ContextLoaderListener

        context.setContextPath( "/" );

        context.setInitParameter( "contextConfigLocation", getSpringConfigLocation() );

        ContextLoaderListener contextLoaderListener = new ContextLoaderListener();

        context.addEventListener( contextLoaderListener );

        ServletHolder sh = new ServletHolder( CXFServlet.class );
View Full Code Here

Examples of org.springframework.web.context.ContextLoaderListener

        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING_HOME);
        dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING_PRODUCTS);
        dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING_SERVICES);

        servletContext.addListener(new ContextLoaderListener(rootContext));
    }
View Full Code Here

Examples of org.springframework.web.context.ContextLoaderListener

        ServletRegistration.Dynamic dispatcher = servletContext.addServlet(DISPATCHER_SERVLET_NAME, new DispatcherServlet(rootContext));
        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping(DISPATCHER_SERVLET_MAPPING);

        servletContext.addListener(new ContextLoaderListener(rootContext));

        FilterRegistration.Dynamic urlReWrite = servletContext.addFilter(URL_REWRITE_FILTER_NAME, new UrlRewriteFilter());
        urlReWrite.setInitParameter(URL_REWRITE_FILTER_PARAM_LOGLEVEL, URL_REWRITE_FILTER_LOGLEVEL_SLF4J);
        EnumSet<DispatcherType> urlReWriteDispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD);
        urlReWrite.addMappingForUrlPatterns(urlReWriteDispatcherTypes, true, URL_REWRITE_FILTER_MAPPING);
View Full Code Here

Examples of org.springframework.web.context.ContextLoaderListener

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

    AnnotationConfigWebApplicationContext rootCtx = new AnnotationConfigWebApplicationContext();
    rootCtx.register(ApplicationConfig.class);

    ctx.addListener(new ContextLoaderListener(rootCtx));

    RepositoryRestExporterServlet exporter = new RepositoryRestExporterServlet();

    ServletRegistration.Dynamic reg = ctx.addServlet("rest-exporter", exporter);
    reg.setLoadOnStartup(1);
View Full Code Here

Examples of org.springframework.web.context.ContextLoaderListener

    AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
    rootContext.register(ApplicationContext.class);
    rootContext.setDisplayName("Spring Thymeleaf Tutorial");
   
    //Context loader listener
    servletContext.addListener(new ContextLoaderListener(rootContext));
   
    //Dispatcher servlet
    ServletRegistration.Dynamic dispatcher =
        servletContext.addServlet("dispatcher", new DispatcherServlet(rootContext));
    dispatcher.setLoadOnStartup(1);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.