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
  • Constructor Details

    • ViewResolverComposite

      public ViewResolverComposite()
  • Method Details

    • setViewResolvers

      public void setViewResolvers(List<ViewResolver> viewResolvers)
      Set the list of view viewResolvers to delegate to.
    • getViewResolvers

      public List<ViewResolver> getViewResolvers()
      Return the list of view viewResolvers to delegate to.
    • setOrder

      public void setOrder(int order)
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered
    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • setServletContext

      public void setServletContext(ServletContext servletContext)
      Specified by:
      setServletContext in interface org.springframework.web.context.ServletContextAware
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • resolveViewName

      @Nullable public View resolveViewName(String viewName, Locale locale) throws Exception
      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 return null (rather throwing an exception when View creation failed).

      Specified by:
      resolveViewName in interface ViewResolver
      Parameters:
      viewName - name of the view to resolve
      locale - 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)