spring-webmvc

org.springframework.web.servlet.mvc.method.annotation
Class ModelAndViewMethodReturnValueHandler

java.lang.Object
  extended by org.springframework.web.servlet.mvc.method.annotation.ModelAndViewMethodReturnValueHandler
All Implemented Interfaces:
org.springframework.web.method.support.HandlerMethodReturnValueHandler

public class ModelAndViewMethodReturnValueHandler
extends java.lang.Object
implements org.springframework.web.method.support.HandlerMethodReturnValueHandler

Handles return values of type ModelAndView copying view and model information to the ModelAndViewContainer.

If the return value is null, the ModelAndViewContainer.setRequestHandled(boolean) flag is set to false to indicate the request was handled directly.

A ModelAndView return type has a set purpose. Therefore this handler should be configured ahead of handlers that support any return value type annotated with @ModelAttribute or @ResponseBody to ensure they don't take over.

Since:
3.1
Author:
Rossen Stoyanchev

Constructor Summary
ModelAndViewMethodReturnValueHandler()
           
 
Method Summary
 void handleReturnValue(java.lang.Object returnValue, org.springframework.core.MethodParameter returnType, org.springframework.web.method.support.ModelAndViewContainer mavContainer, org.springframework.web.context.request.NativeWebRequest webRequest)
           
 boolean supportsReturnType(org.springframework.core.MethodParameter returnType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelAndViewMethodReturnValueHandler

public ModelAndViewMethodReturnValueHandler()
Method Detail

supportsReturnType

public boolean supportsReturnType(org.springframework.core.MethodParameter returnType)
Specified by:
supportsReturnType in interface org.springframework.web.method.support.HandlerMethodReturnValueHandler

handleReturnValue

public void handleReturnValue(java.lang.Object returnValue,
                              org.springframework.core.MethodParameter returnType,
                              org.springframework.web.method.support.ModelAndViewContainer mavContainer,
                              org.springframework.web.context.request.NativeWebRequest webRequest)
                       throws java.lang.Exception
Specified by:
handleReturnValue in interface org.springframework.web.method.support.HandlerMethodReturnValueHandler
Throws:
java.lang.Exception

spring-webmvc