public class ViewResolverComposite extends Object implements ViewResolver, Ordered, InitializingBean, ApplicationContextAware, ServletContextAware
ViewResolver
that delegates to others.HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
Constructor and Description |
---|
ViewResolverComposite() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
|
int |
getOrder()
Get the order value of this object.
|
List<ViewResolver> |
getViewResolvers()
Return the list of view viewResolvers to delegate to.
|
View |
resolveViewName(String viewName,
Locale locale)
Resolve the given view by name.
|
void |
setApplicationContext(ApplicationContext applicationContext)
Set the ApplicationContext that this object runs in.
|
void |
setOrder(int order) |
void |
setServletContext(ServletContext servletContext)
Set the
ServletContext that this object runs in. |
void |
setViewResolvers(List<ViewResolver> viewResolvers)
Set the list of view viewResolvers to delegate to.
|
public void setViewResolvers(List<ViewResolver> viewResolvers)
public List<ViewResolver> getViewResolvers()
public void setOrder(int order)
public int getOrder()
Ordered
Higher values are interpreted as lower priority. As a consequence,
the object with the lowest value has the highest priority (somewhat
analogous to Servlet load-on-startup
values).
Same order values will result in arbitrary sort positions for the affected objects.
getOrder
in interface Ordered
Ordered.HIGHEST_PRECEDENCE
,
Ordered.LOWEST_PRECEDENCE
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
ApplicationContextAware
Invoked after population of normal bean properties but before an init callback such
as InitializingBean.afterPropertiesSet()
or a custom init-method. Invoked after ResourceLoaderAware.setResourceLoader(org.springframework.core.io.ResourceLoader)
,
ApplicationEventPublisherAware.setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher)
and
MessageSourceAware
, if applicable.
setApplicationContext
in interface ApplicationContextAware
applicationContext
- the ApplicationContext object to be used by this objectApplicationContextException
- in case of context initialization errorsBeansException
- if thrown by application context methodsBeanInitializationException
public void setServletContext(ServletContext servletContext)
ServletContextAware
ServletContext
that this object runs in.
Invoked after population of normal bean properties but before an init
callback like InitializingBean's afterPropertiesSet
or a
custom init-method. Invoked after ApplicationContextAware's
setApplicationContext
.
setServletContext
in interface ServletContextAware
servletContext
- ServletContext object to be used by this objectInitializingBean.afterPropertiesSet()
,
ApplicationContextAware.setApplicationContext(org.springframework.context.ApplicationContext)
public void afterPropertiesSet() throws Exception
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
Exception
- in the event of misconfiguration (such
as failure to set an essential property) or if initialization fails.public View resolveViewName(String viewName, Locale locale) throws Exception
ViewResolver
Note: To allow for ViewResolver chaining, a ViewResolver should
return null
if a view with the given name is not defined in it.
However, this is not required: Some ViewResolvers will always attempt
to build View objects with the given name, unable to return null
(rather throwing an exception when View creation failed).
resolveViewName
in interface ViewResolver
viewName
- name of the view to resolvelocale
- Locale in which to resolve the view.
ViewResolvers that support internationalization should respect this.null
if not found
(optional, to allow for ViewResolver chaining)Exception
- if the view cannot be resolved
(typically in case of problems creating an actual View object)