Class XmlViewResolver

java.lang.Object
org.springframework.context.support.ApplicationObjectSupport
org.springframework.web.context.support.WebApplicationObjectSupport
org.springframework.web.servlet.view.AbstractCachingViewResolver
org.springframework.web.servlet.view.XmlViewResolver
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.core.Ordered, org.springframework.web.context.ServletContextAware, ViewResolver

@Deprecated public class XmlViewResolver extends AbstractCachingViewResolver implements org.springframework.core.Ordered, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
Deprecated.
as of 5.3, in favor of Spring's common view resolver variants and/or custom resolver implementations
A ViewResolver implementation that uses bean definitions in a dedicated XML file for view definitions, specified by resource location. The file will typically be located in the WEB-INF directory; the default is "/WEB-INF/views.xml".

This ViewResolver does not support internationalization at the level of its definition resources. Consider ResourceBundleViewResolver if you need to apply different view resources per locale.

Note: This ViewResolver implements the Ordered interface in order to allow for flexible participation in ViewResolver chaining. For example, some special views could be defined via this ViewResolver (giving it 0 as "order" value), while all remaining views could be resolved by a UrlBasedViewResolver.

Since:
18.06.2003
Author:
Juergen Hoeller
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver

    AbstractCachingViewResolver.CacheFilter
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Deprecated.
    Default if no other location is supplied.

    Fields inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver

    DEFAULT_CACHE_LIMIT

    Fields inherited from class org.springframework.context.support.ApplicationObjectSupport

    logger

    Fields inherited from interface org.springframework.core.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Deprecated.
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated.
    Pre-initialize the factory from the XML file.
    void
    Deprecated.
    Close the view bean factory on context shutdown.
    protected Object
    getCacheKey(String viewName, Locale locale)
    Deprecated.
    This implementation returns just the view name, as XmlViewResolver doesn't support localized resolution.
    int
    Deprecated.
     
    protected org.springframework.beans.factory.BeanFactory
    Deprecated.
    Initialize the view bean factory from the XML file.
    protected View
    loadView(String viewName, Locale locale)
    Deprecated.
    Subclasses must implement this method, building a View object for the specified view.
    void
    setLocation(org.springframework.core.io.Resource location)
    Deprecated.
    Set the location of the XML file that defines the view beans.
    void
    setOrder(int order)
    Deprecated.
    Specify the order value for this ViewResolver bean.

    Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport

    getServletContext, getTempDir, getWebApplicationContext, initApplicationContext, initServletContext, isContextRequired, setServletContext

    Methods inherited from class org.springframework.context.support.ApplicationObjectSupport

    getApplicationContext, getMessageSourceAccessor, initApplicationContext, obtainApplicationContext, requiredContextClass, setApplicationContext

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_LOCATION

      public static final String DEFAULT_LOCATION
      Deprecated.
      Default if no other location is supplied.
      See Also:
  • Constructor Details

    • XmlViewResolver

      public XmlViewResolver()
      Deprecated.
  • Method Details

    • setLocation

      public void setLocation(org.springframework.core.io.Resource location)
      Deprecated.
      Set the location of the XML file that defines the view beans.

      The default is "/WEB-INF/views.xml".

      Parameters:
      location - the location of the XML file.
    • setOrder

      public void setOrder(int order)
      Deprecated.
      Specify the order value for this ViewResolver bean.

      The default value is Ordered.LOWEST_PRECEDENCE, meaning non-ordered.

      See Also:
      • Ordered.getOrder()
    • getOrder

      public int getOrder()
      Deprecated.
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • afterPropertiesSet

      public void afterPropertiesSet() throws org.springframework.beans.BeansException
      Deprecated.
      Pre-initialize the factory from the XML file. Only effective if caching is enabled.
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      org.springframework.beans.BeansException
    • getCacheKey

      protected Object getCacheKey(String viewName, Locale locale)
      Deprecated.
      This implementation returns just the view name, as XmlViewResolver doesn't support localized resolution.
      Overrides:
      getCacheKey in class AbstractCachingViewResolver
    • loadView

      protected View loadView(String viewName, Locale locale) throws org.springframework.beans.BeansException
      Deprecated.
      Description copied from class: AbstractCachingViewResolver
      Subclasses must implement this method, building a View object for the specified view. The returned View objects will be cached by this ViewResolver base class.

      Subclasses are not forced to support internationalization: A subclass that does not may simply ignore the locale parameter.

      Specified by:
      loadView in class AbstractCachingViewResolver
      Parameters:
      viewName - the name of the view to retrieve
      locale - the Locale to retrieve the view for
      Returns:
      the View instance, or null if not found (optional, to allow for ViewResolver chaining)
      Throws:
      org.springframework.beans.BeansException
      See Also:
    • initFactory

      protected org.springframework.beans.factory.BeanFactory initFactory() throws org.springframework.beans.BeansException
      Deprecated.
      Initialize the view bean factory from the XML file. Synchronized because of access by parallel threads.
      Throws:
      org.springframework.beans.BeansException - in case of initialization errors
    • destroy

      public void destroy() throws org.springframework.beans.BeansException
      Deprecated.
      Close the view bean factory on context shutdown.
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean
      Throws:
      org.springframework.beans.BeansException