Deprecated
as of 5.3, in favor of Spring's common view resolver variants and/or custom resolver implementations
org.springframework.web.servlet.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.
org.springframework.context.ApplicationContext#getResource , UrlBasedViewResolver, BeanNameViewResolver
| Modifier and Type | Field and Description |
|---|---|
| private ConfigurableApplicationContext | |
| public static final String | DEFAULT_LOCATION
Default if no other location is supplied. |
| private Resource | |
| private int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | afterPropertiesSet()
Implements org. Pre-initialize the factory from the XML file. |
| public void | destroy()
Implements org. Close the view bean factory on context shutdown. |
| protected Object | getCacheKey(String viewName, Locale locale)
Overrides org. This implementation returns just the view name, as XmlViewResolver doesn't support localized resolution. |
| public int | |
| protected synchronized BeanFactory | |
| protected View | loadView(String
the name of the view to retrieve viewName, Locale the Locale to retrieve the view for locale)Implements abstract org. Subclasses must implement this method, building a View object for the specified view. |
| public void | setLocation(Resource
the location of the XML file. location)Set the location of the XML file that defines the view beans. |
| public void |
| cachedFactory | back to summary |
|---|---|
| private ConfigurableApplicationContext cachedFactory
| |
| DEFAULT_LOCATION | back to summary |
|---|---|
| public static final String DEFAULT_LOCATION Default if no other location is supplied. | |
| location | back to summary |
|---|---|
| private Resource location
| |
| order | back to summary |
|---|---|
| private int order | |
| XmlViewResolver | back to summary |
|---|---|
| public XmlViewResolver() | |
| afterPropertiesSet | back to summary |
|---|---|
| public void afterPropertiesSet() throws BeansException Implements org. Pre-initialize the factory from the XML file. Only effective if caching is enabled.
| |
| destroy | back to summary |
|---|---|
| public void destroy() throws BeansException Implements org. Close the view bean factory on context shutdown.
| |
| getCacheKey | back to summary |
|---|---|
| protected Object getCacheKey(String viewName, Locale locale) Overrides org. This implementation returns just the view name, as XmlViewResolver doesn't support localized resolution.
| |
| getOrder | back to summary |
|---|---|
| public int getOrder() Implements org. Doc from org. Get the order value of this object. Higher values are interpreted as lower priority. As a consequence,
the object with the lowest value has the highest priority (somewhat
analogous to Servlet Same order values will result in arbitrary sort positions for the affected objects.
| |
| initFactory | back to summary |
|---|---|
| protected synchronized BeanFactory initFactory() throws BeansException Initialize the view bean factory from the XML file. Synchronized because of access by parallel threads.
| |
| loadView | back to summary |
|---|---|
| protected View loadView(String viewName, Locale locale) throws BeansException Implements abstract org. Doc from org. 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. | |
| setLocation | back to summary |
|---|---|
| public void setLocation(Resource location) Set the location of the XML file that defines the view beans. The default is "/WEB-INF/views.xml".
| |
| setOrder | back to summary |
|---|---|
| public void setOrder(int order) Specify the order value for this ViewResolver bean. The default value is | |