Package org.springframework.web.context

Examples of org.springframework.web.context.ContextLoaderListener


    public void onStartup(final ServletContext sc) throws ServletException {

        //1、根上下文
        AnnotationConfigWebApplicationContext  rootContext = new AnnotationConfigWebApplicationContext();
        rootContext.register(RootConfiguration.class);
        sc.addListener(new ContextLoaderListener(rootContext));

        //2、springmvc上下文
        AnnotationConfigWebApplicationContext springMvcContext = new AnnotationConfigWebApplicationContext();
        springMvcContext.register(SpringMvcConfiguration.class);
View Full Code Here


        context.setContextPath( "/" );

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

        ContextLoaderListener contextLoaderListener = new ContextLoaderListener();

        context.addEventListener( contextLoaderListener );

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

        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

        FilterRegistration.Dynamic sitemesh = servletContext.addFilter("sitemesh", new ConfigurableSiteMeshFilter());
        EnumSet<DispatcherType> sitemeshDispatcherTypes = EnumSet.of(DispatcherType.REQUEST, DispatcherType.FORWARD);
        sitemesh.addMappingForUrlPatterns(sitemeshDispatcherTypes, true, "*.jsp");

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

public class HttpManagedTest extends TestCase {

    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

        server = new Server(getPort());
        Context context = new Context(server, getBasePath(), Context.SESSIONS);
        Map<String, String> params = new HashMap<String, String>();
        params.put(ContextLoaderListener.CONFIG_LOCATION_PARAM, getSpringContextLocation());
        context.setInitParams(params);
        context.addEventListener(new ContextLoaderListener());
        context.addEventListener(new RequestContextListener());
        context.addServlet(sh, getServletMapping());
        server.start();
        LOG.info("Jetty server running.");
        applicationContext = WebApplicationContextUtils.getWebApplicationContext(context.getServletContext());
View Full Code Here

        server = new Server(getPort());
        Context context = new Context(server, getBasePath(), Context.SESSIONS);
        Map<String, String> params = new HashMap<String, String>();
        params.put(ContextLoaderListener.CONFIG_LOCATION_PARAM, getSpringContextLocation());
        context.setInitParams(params);
        context.addEventListener(new ContextLoaderListener());
        context.addEventListener(new RequestContextListener());
        context.addServlet(sh, getServletMapping());
        server.start();
        LOG.info("Jetty server running.");
        this.applicationContext = WebApplicationContextUtils.getWebApplicationContext(context.getServletContext());
View Full Code Here

        server = new Server(getPort());
        Context context = new Context(server, getBasePath(), Context.SESSIONS);
        Map<String, String> params = new HashMap<String, String>();
        params.put(ContextLoaderListener.CONFIG_LOCATION_PARAM, getSpringContextLocation());
        context.setInitParams(params);
        context.addEventListener(new ContextLoaderListener());
        context.addEventListener(new RequestContextListener());
        context.addServlet(sh, getServletMapping());
        server.start();
        LOG.info("Jetty server running.");
        applicationContext = WebApplicationContextUtils.getWebApplicationContext(context.getServletContext());
View Full Code Here

        server = new Server(getPort());
        Context context = new Context(server, getBasePath(), Context.SESSIONS);
        Map<String, String> params = new HashMap<String, String>();
        params.put(ContextLoaderListener.CONFIG_LOCATION_PARAM, getSpringContextLocation());
        context.setInitParams(params);
        context.addEventListener(new ContextLoaderListener());
        context.addEventListener(new RequestContextListener());
        context.addServlet(sh, getServletMapping());
        server.start();
        LOG.info("Jetty server running.");
        this.applicationContext = WebApplicationContextUtils.getWebApplicationContext(context.getServletContext());
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/web/http/spring-web.xml");
        initParams.put("contextClass", XmlWebApplicationContext.class.getName());
        context.setInitParams(initParams);
        ServletHolder holder = 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.