Package org.springframework.web.context

Examples of org.springframework.web.context.ContextLoaderListener


  @Override
  public void onStartup(ServletContext servletContext) throws ServletException {
    AnnotationConfigWebApplicationContext rootContext = new AnnotationConfigWebApplicationContext();
    rootContext.register(ApplicationConfiguration.class);
    rootContext.setDisplayName("Movie database");
    servletContext.addListener(new ContextLoaderListener(rootContext));
    ServletRegistration.Dynamic dispatcher =
        servletContext.addServlet("dispatcher", new DispatcherServlet(rootContext));
    dispatcher.setLoadOnStartup(1);
    dispatcher.addMapping("/");
   
View Full Code Here


        servletContext.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
                StringUtils.arrayToCommaDelimitedString(locations)
        );

        // Start context loader w/ mock servlet prior to firing off registry
        listener = new ContextLoaderListener();
        listener.contextInitialized(new ServletContextEvent(servletContext));


        tester = new PageTester(appPackage, appName, "src/main/webapp", AppTestModule.class) {
            @Override
View Full Code Here

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

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

        FilterRegistration.Dynamic security = servletContext.addFilter("springSecurityFilterChain", new DelegatingFilterProxy());
        EnumSet<DispatcherType> securityDispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD);
        security.addMappingForUrlPatterns(securityDispatcherTypes, true, "/*");

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

        // creates the web app context
        AnnotationConfigWebApplicationContext webContext = new AnnotationConfigWebApplicationContext();
        webContext.register(WebAppConfig.class);

        // registers context load listener
        servletContext.addListener(new ContextLoaderListener(new AnnotationConfigWebApplicationContext()));

        // adds a dispatch servlet, the servlet will be configured from root web app context
        ServletRegistration.Dynamic servletConfig = servletContext.addServlet("employee",
                new DispatcherServlet(webContext));
        servletConfig.setLoadOnStartup(1);
View Full Code Here

        // creates the web root app context
        AnnotationConfigWebApplicationContext webRootContext = new AnnotationConfigWebApplicationContext();
        webRootContext.register(WebAppConfig.class);

        // registers context load listener
        servletContext.addListener(new ContextLoaderListener(webRootContext));

        // adds a dispatch servlet, the servlet will be configured from root web app context
        ServletRegistration.Dynamic servletConfig = servletContext.addServlet("employee",
                new DispatcherServlet(new AnnotationConfigWebApplicationContext()));
        servletConfig.setLoadOnStartup(1);
View Full Code Here

    Map<String, String> param = new HashMap<String, String>();
    param.put("contextConfigLocation", "classpath:context.xml");
    root.setInitParams(param);
    root.addEventListener(new RequestContextListener());
    root.addEventListener(new ContextLoaderListener());
    root.addServlet(org.apache.cxf.transport.servlet.CXFServlet.class, "/services/*");

    server.start();

    SpringJAXRSServerFactoryBean factoryBean = new JAXRSServerFactoryBeanDefinitionParser.SpringJAXRSServerFactoryBean();
View Full Code Here

    }

    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/http/spring-web.xml");
        initParams.put("contextClass", XmlWebApplicationContext.class.getName());
        context.setInitParams(initParams);
        ServletHolder holder = new ServletHolder();
View Full Code Here

            throws ServletException {
        beforeSpringSecurityFilterChain(servletContext);
        if(configurationClasses != null) {
            AnnotationConfigWebApplicationContext rootAppContext = new AnnotationConfigWebApplicationContext();
            rootAppContext.register(configurationClasses);
            servletContext.addListener(new ContextLoaderListener(rootAppContext));
        }
        if(enableHttpSessionEventPublisher()) {
            servletContext.addListener("org.springframework.security.web.session.HttpSessionEventPublisher");
        }
        servletContext.setSessionTrackingModes(getSessionTrackingModes());
View Full Code Here

        String webappDir = System.getProperty("webapp.dir");

        WebAppContext webCtx = new WebAppContext(webappDir == null ? "src/main/webapp" : webappDir, getContextPath());

        if (StringUtils.hasText(getContextConfigLocations())) {
            webCtx.addEventListener(new ContextLoaderListener());
            webCtx.addEventListener(new HttpSessionEventPublisher());
            webCtx.getInitParams().put("contextConfigLocation", getContextConfigLocations());
        }

        ServletHolder servlet = new ServletHolder();
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.