Package org.springframework.web.context

Examples of org.springframework.web.context.ContextLoaderListener


  public void onStartup(ServletContext servletContext)
      throws ServletException {
    AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext();
    ctx.register(WebAppConfig.class);
    servletContext.addListener(new ContextLoaderListener(ctx));

    ctx.setServletContext(servletContext);

    Dynamic servlet = servletContext.addServlet("dispatcher", new DispatcherServlet(ctx));
    servlet.addMapping("/");
View Full Code Here


        security.addMappingForUrlPatterns(dispatcherTypes, true, "/*");

        FilterRegistration.Dynamic sitemesh = servletContext.addFilter("sitemesh", new ConfigurableSiteMeshFilter());
        sitemesh.addMappingForUrlPatterns(dispatcherTypes, true, "*.jsp");

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

        ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);

        context.setDisplayName("Jetty Spring Security Webapp");
        context.setContextPath("/");
        context.getInitParams().put("contextConfigLocation", "classpath:applicationContext.xml");
        context.addEventListener(new ContextLoaderListener());
       
        FilterHolder springSecurityFilter = new FilterHolder(org.springframework.web.filter.DelegatingFilterProxy.class);
        springSecurityFilter.setName("springSecurityFilterChain");
        context.addFilter(springSecurityFilter, "/*", 1);
       
View Full Code Here

        rootContext.register(WebConfig.class);

        ServletRegistration.Dynamic dispatcher = servletContext.addServlet("dispatcher", new DispatcherServlet(rootContext));
        dispatcher.setLoadOnStartup(1);
        dispatcher.addMapping("/*");
        servletContext.addListener(new ContextLoaderListener(rootContext));
    }
View Full Code Here

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

        String pkg = ClassUtils.classPackageAsResourcePath(Constants.class);
        sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
                "classpath*:/" + pkg + "/dao/applicationContext-*.xml," +
                "classpath*:META-INF/applicationContext-*.xml");
       
        ServletContextListener contextListener = new ContextLoaderListener();
        ServletContextEvent event = new ServletContextEvent(sc);
        contextListener.contextInitialized(event);
    }
View Full Code Here

  private ContextLoaderListener contextLoaderListener;

  private static final String PLUTO_SERVICE_CONFIG_LOCATION = "classpath:pluto-portal-driver-services-config.xml";

  public OverrideContextLoaderListener() {
    this.contextLoaderListener = new ContextLoaderListener();
  }
View Full Code Here

  @Override
  public final void onStartup(final ServletContext servletContext) throws ServletException {
    final AnnotationConfigWebApplicationContext context =
        new AnnotationConfigWebApplicationContext();

    servletContext.addListener(new ContextLoaderListener(context));

    Pair<MutablePropertySources, Map<String, Object>> propertyConfig =
        propertySources(servletContext.getContextPath(), context);
    MutablePropertySources propertySources = propertyConfig.getLeft();
View Full Code Here

        final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
        root.scan("org.baeldung.spring.web.config");
        // root.getEnvironment().setDefaultProfiles("embedded");

        // Manages the lifecycle of the root application context
        sc.addListener(new ContextLoaderListener(root));

        // Handles requests into the application
        final ServletRegistration.Dynamic appServlet = sc.addServlet("mvc", new DispatcherServlet(new GenericWebApplicationContext()));
        appServlet.setLoadOnStartup(1);
        final Set<String> mappingConflicts = appServlet.addMapping("/");
View Full Code Here

        final AnnotationConfigWebApplicationContext root = new AnnotationConfigWebApplicationContext();
        root.scan("org.baeldung.spring.config");
        // root.getEnvironment().setDefaultProfiles("embedded");

        // Manages the lifecycle of the root application context
        sc.addListener(new ContextLoaderListener(root));

        // Handles requests into the application
        final ServletRegistration.Dynamic appServlet = sc.addServlet("mvc", new DispatcherServlet(new GenericWebApplicationContext()));
        appServlet.setLoadOnStartup(1);
        final Set<String> mappingConflicts = appServlet.addMapping("/");
View Full Code Here

TOP

Related Classes of org.springframework.web.context.ContextLoaderListener

Copyright © 2018 www.massapicom. 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.