org.springframework.web.servlet.mvc.annotation
Interface ModelAndViewResolver


public interface ModelAndViewResolver

SPI for resolving custom return values from a specific handler method. Typically implemented to detect special return types, resolving well-known result values for them.

A typical implementation could look like as follows:

 public class MyModelAndViewResolver implements ModelAndViewResolver {

   public ModelAndView resolveModelAndView(Method handlerMethod,
                                        Class handlerType,
                                        Object returnValue,
                                        ExtendedModelMap implicitModel,
                                        NativeWebRequest webRequest) {
     if (returnValue instanceof MySpecialRetVal.class)) {
       return new MySpecialRetVal(returnValue);
     }
     return UNRESOLVED;
   }
 }

Since:
3.0
Author:
Arjen Poutsma
See Also:
AnnotationMethodHandlerAdapter.setCustomModelAndViewResolvers(org.springframework.web.servlet.mvc.annotation.ModelAndViewResolver[]), AnnotationMethodHandlerAdapter.setCustomModelAndViewResolvers(org.springframework.web.servlet.mvc.annotation.ModelAndViewResolver[])

Field Summary
static ModelAndView UNRESOLVED
          Marker to be returned when the resolver does not know how to handle the given method parameter.
 
Method Summary
 ModelAndView resolveModelAndView(Method handlerMethod, Class handlerType, Object returnValue, ExtendedModelMap implicitModel, NativeWebRequest webRequest)
           
 

Field Detail

UNRESOLVED

static final ModelAndView UNRESOLVED
Marker to be returned when the resolver does not know how to handle the given method parameter.

Method Detail

resolveModelAndView

ModelAndView resolveModelAndView(Method handlerMethod,
                                 Class handlerType,
                                 Object returnValue,
                                 ExtendedModelMap implicitModel,
                                 NativeWebRequest webRequest)