Package org.springframework.web.context.support

Examples of org.springframework.web.context.support.XmlWebApplicationContext


        String configuration = "/WEB-INF/webconsole-" + webconsoleType + ".xml";

        LOG.info("Web console type: " + webconsoleType);

        XmlWebApplicationContext context = new XmlWebApplicationContext();
        context.setServletContext(servletContext);
        context.setConfigLocations(new String[] {
            configuration
        });
        context.refresh();
        context.start();

        servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);

        return context;
    }
View Full Code Here


        servletContext.setAttribute(WebClient.CONNECTION_FACTORY_ATTRIBUTE, connectionFactory);
        WebClient.initContext(servletContext);
    }

    public void contextDestroyed(ServletContextEvent event) {
        XmlWebApplicationContext context = (XmlWebApplicationContext)WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());
        if (context != null) {
            context.stop();
            context.destroy();
        }
        // do nothing, since the context is destroyed anyway
    }
View Full Code Here

   *
   * @return application context instance
   */
  protected ConfigurableWebApplicationContext newApplicationContext()
  {
    return new XmlWebApplicationContext();
  }
View Full Code Here

    }

    public void testWithSpringContext() throws Exception {
       

        ConfigurableWebApplicationContext ac = new XmlWebApplicationContext();
        ServletContext msc = (ServletContext) new MockServletContext();
        msc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ac);
        ac.setServletContext(msc);
        ac.setConfigLocations(new String[] {"org/apache/struts2/spring/StrutsSpringObjectFactoryTest-applicationContext.xml"});
        ac.refresh();
        StrutsSpringObjectFactory fac = new StrutsSpringObjectFactory("constructor", null, null, msc);

        assertEquals(AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, fac.getAutowireStrategy());
    }
View Full Code Here

    private WebApplicationContext createWebapplicationContext(ServletContext servletContext, String webconsoleType) {
        String configuration = "/WEB-INF/webconsole-" + webconsoleType + ".xml";
        LOG.debug("Web console type: " + webconsoleType);

        XmlWebApplicationContext context = new XmlWebApplicationContext();
        context.setServletContext(servletContext);
        context.setConfigLocations(new String[] {
            configuration
        });
        context.refresh();
        context.start();

        servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);

        return context;
    }
View Full Code Here

        servletContext.setAttribute(WebClient.CONNECTION_FACTORY_ATTRIBUTE, connectionFactory);
        WebClient.initContext(servletContext);
    }

    public void contextDestroyed(ServletContextEvent event) {
        XmlWebApplicationContext context = (XmlWebApplicationContext)WebApplicationContextUtils.getWebApplicationContext(event.getServletContext());
        if (context != null) {
            context.stop();
            context.destroy();
        }
        // do nothing, since the context is destroyed anyway
    }
View Full Code Here

   *
   * @return application context instance
   */
  protected ConfigurableWebApplicationContext newApplicationContext()
  {
    return new XmlWebApplicationContext();
  }
View Full Code Here

  public static WicketTester getWicketTester(long langId) {
    Application app = new Application();
       
    WicketTester tester = new WicketTester(app);
    ServletContext sc = app.getServletContext();
        XmlWebApplicationContext xmlContext = new XmlWebApplicationContext();
        xmlContext.setConfigLocation("classpath:openmeetings-applicationContext.xml");
        xmlContext.setServletContext(sc);
        xmlContext.refresh();
        sc.setAttribute(ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, xmlContext);
        if (langId > 0) {
          WebSession.get().setLanguage(langId);
        }
        InitializationContainer.initComplete = true;
View Full Code Here

  public static WicketTester getWicketTester(long langId) {
    Application app = new Application();
       
    WicketTester tester = new WicketTester(app);
    ServletContext sc = app.getServletContext();
        XmlWebApplicationContext xmlContext = new XmlWebApplicationContext();
        xmlContext.setConfigLocation("classpath:openmeetings-applicationContext.xml");
        xmlContext.setServletContext(sc);
        xmlContext.refresh();
        sc.setAttribute(ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, xmlContext);
        if (langId > 0) {
          WebSession.get().setLanguage(langId);
        }
        InitializationContainer.initComplete = true;
View Full Code Here

    public void setClusterConfigDao(ClusterConfigDao clusterConfigDao) {
        this.clusterConfigDao = clusterConfigDao;
    }
   
    private boolean isReady(ContextRefreshedEvent event) {
        XmlWebApplicationContext context = (XmlWebApplicationContext) event.getSource();
        return context.getServletConfig() != null;
    }
View Full Code Here

TOP

Related Classes of org.springframework.web.context.support.XmlWebApplicationContext

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.