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 TypeMethodDescriptionvoidintgetOrder()Return the list of view viewResolvers to delegate to.resolveViewName(String viewName, Locale locale) Resolve the given view by name.voidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetOrder(int order) voidsetServletContext(jakarta.servlet.ServletContext servletContext) voidsetViewResolvers(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:
getOrderin interfaceorg.springframework.core.Ordered
-
setApplicationContext
public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException - Specified by:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
setServletContext
public void setServletContext(jakarta.servlet.ServletContext servletContext) - Specified by:
setServletContextin interfaceorg.springframework.web.context.ServletContextAware
-
afterPropertiesSet
-
resolveViewName
Description copied from interface:ViewResolverResolve the given view by name.Note: To allow for ViewResolver chaining, a ViewResolver should return
nullif 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:
resolveViewNamein 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
nullif 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)
-