Example usage for org.springframework.web.context.support XmlWebApplicationContext XmlWebApplicationContext

List of usage examples for org.springframework.web.context.support XmlWebApplicationContext XmlWebApplicationContext

Introduction

In this page you can find the example usage for org.springframework.web.context.support XmlWebApplicationContext XmlWebApplicationContext.

Prototype

XmlWebApplicationContext

Source Link

Usage

From source file:de.itsvs.cwtrpc.controller.config.AutowiredRemoteServiceGroupConfigBeanDefinitionParserTest.java

@BeforeClass
public static void initClass() {
    ServletContext servletContext;//from w ww. jav a  2  s  . co m
    XmlWebApplicationContext appContext;

    servletContext = new MockServletContext();
    appContext = new XmlWebApplicationContext();
    appContext.setConfigLocation("classpath:/de/itsvs/cwtrpc/controller/config/"
            + "AutowiredRemoteServiceGroupConfigBeanDefinitionParserTest1.xml");
    appContext.setServletContext(servletContext);
    appContext.refresh();

    AutowiredRemoteServiceGroupConfigBeanDefinitionParserTest.appContext = appContext;
}

From source file:de.itsvs.cwtrpc.controller.config.RemoteServiceControllerConfigBeanDefinitionParserTest.java

@BeforeClass
public static void initClass() {
    ServletContext servletContext;//w w  w  . j a v  a  2  s .  c  om
    XmlWebApplicationContext appContext;

    servletContext = new MockServletContext();

    appContext = new XmlWebApplicationContext();
    appContext.setConfigLocation("classpath:/de/itsvs/cwtrpc/controller/config/"
            + "RemoteServiceControllerConfigBeanDefinitionParserTest1.xml");
    appContext.setServletContext(servletContext);
    appContext.refresh();
    RemoteServiceControllerConfigBeanDefinitionParserTest.appContext = appContext;
}

From source file:org.springside.modules.test.spring.SpringWebTestHelper.java

/**
 * ServletContext?Spring WebApplicationContext.
 * /*from  ww w  . java  2s  .c om*/
 * @param applicationContext ApplicationContext.
 */
public static void initWebApplicationContext(MockServletContext servletContext,
        ApplicationContext applicationContext) {
    ConfigurableWebApplicationContext wac = new XmlWebApplicationContext();
    wac.setParent(applicationContext);
    wac.setServletContext(servletContext);
    wac.setConfigLocation("");
    servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    wac.refresh();
}

From source file:de.itsvs.cwtrpc.controller.config.RemoteServiceModuleConfigBeanDefinitionParserTest.java

@BeforeClass
public static void initClass() {
    ServletContext servletContext;/*from www  .j  a v a2 s .  co  m*/
    XmlWebApplicationContext appContext;

    servletContext = new MockServletContext();

    appContext = new XmlWebApplicationContext();
    appContext.setConfigLocation("classpath:/de/itsvs/cwtrpc/controller/config/"
            + "RemoteServiceModuleConfigBeanDefinitionParserTest1.xml");
    appContext.setServletContext(servletContext);
    appContext.refresh();
    RemoteServiceModuleConfigBeanDefinitionParserTest.appContext = appContext;
}

From source file:de.itsvs.cwtrpc.controller.config.CacheControlConfigBeanDefinitionParserTest.java

@BeforeClass
public static void initClass() {
    ServletContext servletContext;/*  ww w  . j  a v  a 2 s.com*/
    XmlWebApplicationContext appContext;

    servletContext = new MockServletContext();
    appContext = new XmlWebApplicationContext();
    appContext.setConfigLocation("classpath:/de/itsvs/cwtrpc/controller/config/"
            + "CacheControlConfigBeanDefinitionParserTest1.xml");
    appContext.setServletContext(servletContext);
    appContext.refresh();

    CacheControlConfigBeanDefinitionParserTest.appContext = appContext;
}

From source file:de.itsvs.cwtrpc.controller.config.RemoteServiceGroupConfigBeanDefinitionParserTest.java

@BeforeClass
public static void initClass() {
    ServletContext servletContext;/*ww w.ja v a 2  s .  c  o m*/
    XmlWebApplicationContext appContext;

    servletContext = new MockServletContext();

    appContext = new XmlWebApplicationContext();
    appContext.setConfigLocation("classpath:/de/itsvs/cwtrpc/controller/config/"
            + "RemoteServiceGroupConfigBeanDefinitionParserTest1.xml");
    appContext.setServletContext(servletContext);
    appContext.refresh();
    RemoteServiceGroupConfigBeanDefinitionParserTest.appContext = appContext;

    appContext = new XmlWebApplicationContext();
    appContext.setConfigLocation("classpath:/de/itsvs/cwtrpc/controller/config/"
            + "RemoteServiceGroupConfigBeanDefinitionParserTest2.xml");
    appContext.setServletContext(servletContext);
    appContext.refresh();
    RemoteServiceGroupConfigBeanDefinitionParserTest.appContext2 = appContext;
}

From source file:com.contact.MyWebAppInitializer.java

public void onStartup(ServletContext container) throws ServletException {
    XmlWebApplicationContext appContext = new XmlWebApplicationContext();

    appContext.setConfigLocation("/WEB-INF/spring/appServlet/servlet-context.xml");

    ServletRegistration.Dynamic dispatcher = container.addServlet("appServlet",
            new DispatcherServlet(appContext));

    MultipartConfigElement multipartConfigElement = new MultipartConfigElement(null, 5000000, 5000000, 0);
    dispatcher.setMultipartConfig(multipartConfigElement);

    dispatcher.setLoadOnStartup(1);//from w w w .  ja  va  2  s .  co  m
    dispatcher.addMapping("/");
}

From source file:com.dm.platform.spring.MyWebApplicationInitializer.java

public void onStartup(ServletContext container) {
    System.out.println("MyWebApplicationInitializer[onStartup]");
    XmlWebApplicationContext ac = new XmlWebApplicationContext();
    container.addListener(new ContextLoaderListener(ac));

    //        ServletRegistration.Dynamic registration = container.addServlet("dispatcher", new DispatcherServlet());
    //        registration.setLoadOnStartup(1);
    //        registration.addMapping("/spring/*");
}

From source file:com.dm.platform.spring.MyWebAppInitializer.java

protected WebApplicationContext createServletApplicationContext() {
    XmlWebApplicationContext cxt = new XmlWebApplicationContext();
    cxt.setConfigLocation("/WEB-INF/dispatcher-servlet.xml");
    return cxt;//from   w w w .  j  av  a 2s.  c  om
}

From source file:org.springsource.sinspctr.AdminMain.java

/**
* Launch stream server with the given home and transport
 * @throws IOException //from  www. j  av  a 2 s.  c o m
*/
static InspctrServer launchStreamServer() throws IOException {
    XmlWebApplicationContext context = new XmlWebApplicationContext();
    context.setConfigLocation("classpath:" + CONFIG_ROOT + "sinspctr-server.xml");

    // Not making StreamServer a spring bean eases move to .war file if
    // needed
    final InspctrServer server = new InspctrServer(context, DEFAULT_PORT);
    server.afterPropertiesSet();
    server.start();
    StringBuilder runtimeInfo = new StringBuilder(
            String.format("Running in Local Mode on port: %s ", server.getPort()));
    System.out.println(BannerUtils.displayBanner(null, runtimeInfo.toString()));
    context.addApplicationListener(new ApplicationListener<ContextClosedEvent>() {
        @Override
        public void onApplicationEvent(ContextClosedEvent event) {
            server.stop();
        }
    });
    context.registerShutdownHook();
    return server;
}