Class ViewMethodReturnValueHandler

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

public class ViewMethodReturnValueHandler extends Object implements org.springframework.web.method.support.HandlerMethodReturnValueHandler
Handles return values that are of type View.

A null return value is left as-is leaving it to the configured RequestToViewNameTranslator to select a view name by convention.

A View 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 Details

    • ViewMethodReturnValueHandler

      public ViewMethodReturnValueHandler()
  • Method Details

    • supportsReturnType

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

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