Class ViewResolverComposite
java.lang.Object
org.springframework.web.servlet.view.ViewResolverComposite
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.InitializingBean
,org.springframework.context.ApplicationContextAware
,org.springframework.core.Ordered
,org.springframework.web.context.ServletContextAware
,ViewResolver
public class ViewResolverComposite
extends Object
implements ViewResolver, org.springframework.core.Ordered, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.web.context.ServletContextAware
A
ViewResolver
that delegates to others.- Since:
- 4.1
- Author:
- Sebastien Deleuze, Rossen Stoyanchev
-
Field Summary
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
int
getOrder()
Return the list of view viewResolvers to delegate to.resolveViewName
(String viewName, Locale locale) Resolve the given view by name.void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setOrder
(int order) void
setServletContext
(ServletContext servletContext) void
setViewResolvers
(List<ViewResolver> viewResolvers) Set the list of view viewResolvers to delegate to.
-
Constructor Details
-
ViewResolverComposite
public ViewResolverComposite()
-
-
Method Details
-
setViewResolvers
Set the list of view viewResolvers to delegate to. -
getViewResolvers
Return the list of view viewResolvers to delegate to. -
setOrder
public void setOrder(int order) -
getOrder
public int getOrder()- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContext
in interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
setServletContext
- Specified by:
setServletContext
in interfaceorg.springframework.web.context.ServletContextAware
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
-
resolveViewName
Description copied from interface:ViewResolver
Resolve the given view by name.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 returnnull
(rather throwing an exception when View creation failed).- Specified by:
resolveViewName
in interfaceViewResolver
- Parameters:
viewName
- name of the view to resolvelocale
- the Locale in which to resolve the view. ViewResolvers that support internationalization should respect this.- Returns:
- the View object, or
null
if not found (optional, to allow for ViewResolver chaining) - Throws:
Exception
- if the view cannot be resolved (typically in case of problems creating an actual View object)
-