Search in sources :

Example 1 with SingleAppResourcePatternResolver

use of com.haulmont.cuba.core.sys.SingleAppResourcePatternResolver in project cuba by cuba-platform.

the class SingleAppRestApiServlet method createWebApplicationContext.

@Override
protected WebApplicationContext createWebApplicationContext(ApplicationContext parent) {
    if (this.logger.isDebugEnabled()) {
        this.logger.debug("Servlet with name '" + getServletName() + "' will try to create custom WebApplicationContext context of class '" + CubaXmlWebApplicationContext.class.getName() + "'" + ", using parent context [" + parent + "]");
    }
    ConfigurableWebApplicationContext wac = new CubaXmlWebApplicationContext() {

        @Override
        protected ResourcePatternResolver getResourcePatternResolver() {
            if (dependencyJars == null || dependencyJars.isEmpty()) {
                throw new RuntimeException("No JARs defined for the 'web' block. " + "Please check that web.dependencies file exists in WEB-INF directory.");
            }
            return new SingleAppResourcePatternResolver(this, dependencyJars);
        }
    };
    wac.setEnvironment(getEnvironment());
    wac.setParent(parent);
    wac.setConfigLocation(getContextConfigLocation());
    configureAndRefreshWebApplicationContext(wac);
    return wac;
}
Also used : ConfigurableWebApplicationContext(org.springframework.web.context.ConfigurableWebApplicationContext) CubaXmlWebApplicationContext(com.haulmont.cuba.core.sys.CubaXmlWebApplicationContext) SingleAppResourcePatternResolver(com.haulmont.cuba.core.sys.SingleAppResourcePatternResolver)

Example 2 with SingleAppResourcePatternResolver

use of com.haulmont.cuba.core.sys.SingleAppResourcePatternResolver in project cuba by cuba-platform.

the class SingleAppIdpServlet method createWebApplicationContext.

@Override
protected WebApplicationContext createWebApplicationContext(ApplicationContext parent) {
    if (this.logger.isDebugEnabled()) {
        this.logger.debug("Servlet with name '" + getServletName() + "' will try to create custom WebApplicationContext context of class '" + CubaXmlWebApplicationContext.class.getName() + "'" + ", using parent context [" + parent + "]");
    }
    ConfigurableWebApplicationContext wac = new CubaXmlWebApplicationContext() {

        @Override
        protected ResourcePatternResolver getResourcePatternResolver() {
            if (dependencyJars == null || dependencyJars.isEmpty()) {
                throw new RuntimeException("No JARs defined for the 'web' block. " + "Please check that web.dependencies file exists in WEB-INF directory.");
            }
            return new SingleAppResourcePatternResolver(this, dependencyJars);
        }
    };
    wac.setEnvironment(getEnvironment());
    wac.setParent(parent);
    wac.setConfigLocation(getContextConfigLocation());
    configureAndRefreshWebApplicationContext(wac);
    return wac;
}
Also used : ConfigurableWebApplicationContext(org.springframework.web.context.ConfigurableWebApplicationContext) CubaXmlWebApplicationContext(com.haulmont.cuba.core.sys.CubaXmlWebApplicationContext) SingleAppResourcePatternResolver(com.haulmont.cuba.core.sys.SingleAppResourcePatternResolver)

Aggregations

CubaXmlWebApplicationContext (com.haulmont.cuba.core.sys.CubaXmlWebApplicationContext)2 SingleAppResourcePatternResolver (com.haulmont.cuba.core.sys.SingleAppResourcePatternResolver)2 ConfigurableWebApplicationContext (org.springframework.web.context.ConfigurableWebApplicationContext)2