Examples of ContextLoaderListener


Examples of org.springframework.web.context.ContextLoaderListener

        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

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

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

        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

        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

Examples of org.springframework.web.context.ContextLoaderListener

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

Examples of org.springframework.web.context.ContextLoaderListener

        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

Examples of org.springframework.web.context.ContextLoaderListener

        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

Examples of org.springframework.web.context.ContextLoaderListener

        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

Examples of org.springframework.web.context.ContextLoaderListener

        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
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.