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

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

Introduction

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

Prototype

@Override
    public void refresh() throws BeansException, IllegalStateException 

Source Link

Usage

From source file:com.predic8.membrane.servlet.RouterUtil.java

public static Router initializeRoutersFromSpringWebContext(XmlWebApplicationContext appCtx,
        final ServletContext ctx, String configLocation) {
    appCtx.setServletContext(ctx);//from   w ww .  j a v  a 2s. co m
    appCtx.setConfigLocation(configLocation);
    appCtx.refresh();

    Collection<Router> routers = appCtx.getBeansOfType(Router.class).values();
    Router theOne = null;
    for (Router r : routers) {
        r.getResolverMap().addSchemaResolver(new FileSchemaWebAppResolver(ctx));
        if (r.getTransport() instanceof ServletTransport) {
            if (theOne != null)
                throw new RuntimeException("Only one <router> may have a <servletTransport> defined.");
            theOne = r;
        }
    }

    appCtx.start();

    return theOne;
}

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

@BeforeClass
public static void initClass() {
    ServletContext servletContext;/*from ww w. j  a va  2  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.AutowiredRemoteServiceGroupConfigBeanDefinitionParserTest.java

@BeforeClass
public static void initClass() {
    ServletContext servletContext;/*  w w  w  . ja  v  a 2 s .  com*/
    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;/*from  ww w  .  ja v  a2s  . com*/
    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:de.ecw.zabos.Globals.java

/**
 * Service Initialisierung. Sollte die Initalisierung fehlschlagen wird dem
 * ServletContainer dies durch eine "UnavailableException" signalisiert.
 * <ul>//  w ww  .  j  a  v  a 2  s. co  m
 * <li>Laden der Konfigurationsdatei ber
 * {@link SpringConfigLoader#loadConfiguration()}</li>
 * <li>Initialisierung der Subsysteme {@link #initSubsystem()}</li>
 * </ul
 * 
 * @param _servletConfig
 * @throws ServletException
 */
public static void init(ServletConfig _servletConfig) throws ServletException {
    synchronized (Globals.class) {
        if (!bInitialized) {
            // Application-Kontext initalisieren
            XmlWebApplicationContext awac = new XmlWebApplicationContext();
            awac.setServletConfig(_servletConfig);

            // Host-spezifische Konfiguration laden
            new SpringConfigLoader(_servletConfig, awac).loadConfiguration();

            awac.refresh();
            SpringContext.getInstance().setApplicationContext(awac);

            initSubsystem();

            log.info("Initialisierung abgeschlossen");
        }
    }
}

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

@BeforeClass
public static void initClass() {
    ServletContext servletContext;//from  ww  w. j ava2s  .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:de.itsvs.cwtrpc.controller.config.CacheControlConfigBeanDefinitionParserTest.java

@BeforeClass
public static void initClass() {
    ServletContext servletContext;//  ww  w .  j ava2  s.c  o m
    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:gov.nih.nci.clinicalconnector.service.globus.ClinicalConnectorProviderImpl.java

public ClinicalConnectorProviderImpl() throws RemoteException {
    XmlWebApplicationContext c = new XmlWebApplicationContext();
    c.setConfigLocation("classpath:applicationContext.xml");
    c.refresh();
    impl = (ClinicalConnectorImpl) c.getBean("clinicalConnectorService");
}

From source file:org.parancoe.web.test.PluginTest.java

@Override
protected ConfigurableApplicationContext createApplicationContext(String[] locations) {
    FileSystemResourceLoader rl = new FileSystemResourceLoader();
    ServletContext servletContext = new MockServletContext(rl);
    XmlWebApplicationContext context = new XmlWebApplicationContext();
    context.setServletContext(servletContext);
    context.setConfigLocations(locations);
    context.refresh();
    return context;
}

From source file:gov.nih.nci.cdmsconnector.c3d.service.globus.C3DGridServiceProviderImpl.java

public C3DGridServiceProviderImpl() throws RemoteException {
    XmlWebApplicationContext c = new XmlWebApplicationContext();
    c.setConfigLocation("classpath:applicationContext.xml");
    c.refresh();
    impl = (C3DGridServiceImpl) c.getBean("c3DGridService");
}