|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
public class XmlViewResolver
Implementation of ViewResolver that uses bean definitions in an XML file, specified by resource location. The file will typically be located in the WEB-INF directory; default is "/WEB-INF/views.xml".
This ViewResolver does not support internationalization. Consider ResourceBundleViewResolver if you need to apply different view resources per locale.
Note: This ViewResolver implements the Ordered interface 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.
ResourceLoader.getResource(java.lang.String)
,
ResourceBundleViewResolver
,
UrlBasedViewResolver
Field Summary | |
---|---|
static String |
DEFAULT_LOCATION
Default if no other location is supplied |
Fields inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
logger |
Constructor Summary | |
---|---|
XmlViewResolver()
|
Method Summary | |
---|---|
void |
destroy()
Close the view bean factory on context shutdown. |
protected String |
getCacheKey(String viewName,
Locale locale)
This implementation returns just the view name, as XmlViewResolver doesn't support localized resolution. |
int |
getOrder()
Return the order value of this object, higher value meaning greater in terms of sorting. |
protected void |
initApplicationContext()
Pre-initialize the factory from the XML file. |
protected BeanFactory |
initFactory()
Initialize the view bean factory from the XML file. |
protected View |
loadView(String viewName,
Locale locale)
Subclasses must implement this method. |
void |
setLocation(Resource location)
Set the location of the XML file that defines the view beans. |
void |
setOrder(int order)
|
Methods inherited from class org.springframework.web.servlet.view.AbstractCachingViewResolver |
---|
clearCache, createView, isCache, removeFromCache, resolveViewName, setCache |
Methods inherited from class org.springframework.web.context.support.WebApplicationObjectSupport |
---|
getServletContext, getTempDir, getWebApplicationContext, isContextRequired |
Methods inherited from class org.springframework.context.support.ApplicationObjectSupport |
---|
getApplicationContext, getMessageSourceAccessor, requiredContextClass, setApplicationContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_LOCATION
Constructor Detail |
---|
public XmlViewResolver()
Method Detail |
---|
public void setOrder(int order)
public int getOrder()
Ordered
Higher value can be interpreted as lower priority, consequently the first object has highest priority (somewhat analogous to Servlet "load-on-startup" values).
getOrder
in interface Ordered
public void setLocation(Resource location)
The default is "/WEB-INF/views.xml".
location
- the location of the XML file.protected void initApplicationContext() throws BeansException
initApplicationContext
in class ApplicationObjectSupport
ApplicationContextException
- in case of initialization errors
BeansException
- if thrown by ApplicationContext methodsApplicationObjectSupport.setApplicationContext(org.springframework.context.ApplicationContext)
protected String getCacheKey(String viewName, Locale locale)
getCacheKey
in class AbstractCachingViewResolver
protected View loadView(String viewName, Locale locale) throws BeansException
AbstractCachingViewResolver
Not all subclasses may support internationalization: A subclass that doesn't can simply ignore the locale parameter.
NOTE: As of Spring 1.2, subclasses are supposed to fully initialize the View objects before returning them, also applying bean container initialization callbacks.
loadView
in class AbstractCachingViewResolver
viewName
- the name of the view to retrievelocale
- the Locale to retrieve the view for
null
if not found
(optional, to allow for ViewResolver chaining)
BeansException
AbstractCachingViewResolver.resolveViewName(java.lang.String, java.util.Locale)
protected BeanFactory initFactory() throws BeansException
BeansException
- in case of initialization errorspublic void destroy() throws BeansException
destroy
in interface DisposableBean
BeansException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |