Top Description Fields Methods
org.springframework.web.servlet.mvc.annotation

public Interface ModelAndViewResolver

Imports
java.lang.reflect.Method, org.springframework.lang.Nullable, org.springframework.ui.ExtendedModelMap, org.springframework.web.context.request.NativeWebRequest, org.springframework.web.servlet.ModelAndView

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;
    }
}
Author
Arjen Poutsma
Since
3.0

Field Summary

Modifier and TypeField and Description
public static final ModelAndView
UNRESOLVED

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

Method Summary

Modifier and TypeMethod and Description
public ModelAndView
resolveModelAndView(Method handlerMethod, Class<?> handlerType, Object returnValue, ExtendedModelMap implicitModel, NativeWebRequest webRequest)

Field Detail

UNRESOLVEDback to summary
public static final ModelAndView UNRESOLVED

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

Method Detail

resolveModelAndViewback to summary
public ModelAndView resolveModelAndView(Method handlerMethod, Class<?> handlerType, Object returnValue, ExtendedModelMap implicitModel, NativeWebRequest webRequest)