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

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

Introduction

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

Prototype

String DEFAULT_CONFIG_LOCATION

To view the source code for org.springframework.web.context.support XmlWebApplicationContext DEFAULT_CONFIG_LOCATION.

Click Source Link

Document

Default config location for the root context.

Usage

From source file:fi.eis.applications.osgi.support.OsgiBundleXmlWebApplicationContext.java

/**
 * {@inheritDoc}//from  ww  w . ja va2 s  .c  o m
 * 
 * Returns the default location for the root context. Default values are
 * "/WEB-INF/applicationContext.xml", and "/WEB-INF/test-servlet.xml" for a
 * context with the namespace "test-servlet" (like for a DispatcherServlet
 * instance with the servlet-name "test").
 * 
 * @see XmlWebApplicationContext#getDefaultConfigLocations()
 * @see XmlWebApplicationContext#DEFAULT_CONFIG_LOCATION
 */
protected String[] getDefaultConfigLocations() {
    String ns = getNamespace();
    if (ns != null) {
        return new String[] { XmlWebApplicationContext.DEFAULT_CONFIG_LOCATION_PREFIX + ns
                + XmlWebApplicationContext.DEFAULT_CONFIG_LOCATION_SUFFIX };
    } else {
        return new String[] { XmlWebApplicationContext.DEFAULT_CONFIG_LOCATION };
    }
}

From source file:com.productone.spring.ServerOsgiBundleXmlWebApplicationContext.java

/**
 * The default location for the root context is
 * "/WEB-INF/applicationContext.xml", and "/WEB-INF/test-servlet.xml" for a
 * context with the namespace "test-servlet" (like for a DispatcherServlet
 * instance with the servlet-name "test").
 *//*w w  w  .j a  v a  2  s.  c  o m*/
@Override
protected String[] getDefaultConfigLocations() {
    String ns = getNamespace();
    if (ns != null) {
        return new String[] { XmlWebApplicationContext.DEFAULT_CONFIG_LOCATION_PREFIX + ns
                + XmlWebApplicationContext.DEFAULT_CONFIG_LOCATION_SUFFIX };
    } else {
        return new String[] { XmlWebApplicationContext.DEFAULT_CONFIG_LOCATION };
    }
}

From source file:org.impalaframework.web.spring.loader.BaseImpalaContextLoader.java

/**
 * Overrides the empty {@link ContextLoader#customizeContext(ServletContext, ConfigurableWebApplicationContext)}
 * by setting the parent {@link ApplicationContext} to use an empty location if the current location is simply the default,
 * and this does not exist. Effectively provides transparent support for "empty" parent {@link ApplicationContext}
 *//*from  w  w  w. j  a v  a  2s .  co  m*/
@Override
protected void customizeContext(ServletContext servletContext,
        ConfigurableWebApplicationContext applicationContext) {

    final String initParameter = servletContext.getInitParameter(CONFIG_LOCATION_PARAM);
    if (initParameter == null) {
        final ServletContextResource servletContextResource = new ServletContextResource(servletContext,
                XmlWebApplicationContext.DEFAULT_CONFIG_LOCATION);
        if (!servletContextResource.exists()) {
            try {
                applicationContext.setConfigLocation("classpath:META-INF/impala-web-empty.xml");
            } catch (UnsupportedOperationException e) {
                //no longer supported in Spring 3.2, so ignore this
            }
        }
    }
}