Top Description Constructors Methods
org.springframework.web.servlet.mvc.method.annotation

public Class DeferredResultMethodReturnValueHandler

extends Object
implements HandlerMethodReturnValueHandler
Class Inheritance
All Implemented Interfaces
org.springframework.web.method.support.HandlerMethodReturnValueHandler
Imports
java.util.concurrent.CompletionException, .CompletionStage, org.springframework.core.MethodParameter, org.springframework.lang.Nullable, org.springframework.web.context.request.NativeWebRequest, org.springframework.web.context.request.async.DeferredResult, .WebAsyncUtils, org.springframework.web.method.support.HandlerMethodReturnValueHandler, .ModelAndViewContainer

Handler for return values of type DeferredResult, org.springframework.util.concurrent.ListenableFuture, and CompletionStage.
Author
Rossen Stoyanchev
Since
3.2

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private DeferredResult<Object>
private DeferredResult<Object>
adaptListenableFuture(ListenableFuture<?> future)
References Deprecated ListenableFuture is deprecated or references (maybe indirectly) at least one deprecated element.

public void
handleReturnValue(Object
the value returned from the handler method
returnValue
,
MethodParameter
the type of the return value. This type must have previously been passed to supportsReturnType which must have returned true.
returnType
,
ModelAndViewContainer
the ModelAndViewContainer for the current request
mavContainer
,
NativeWebRequest
the current request
webRequest
)

Implements org.springframework.web.method.support.HandlerMethodReturnValueHandler.handleReturnValue.

Handle the given return value by adding attributes to the model and setting a view or setting the ModelAndViewContainer#setRequestHandled flag to true to indicate the response has been handled directly.

public boolean
supportsReturnType(MethodParameter
the method return type to check
returnType
)

Implements org.springframework.web.method.support.HandlerMethodReturnValueHandler.supportsReturnType.

Whether the given method return type is supported by this handler.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

DeferredResultMethodReturnValueHandlerback to summary
public DeferredResultMethodReturnValueHandler()

Method Detail

adaptCompletionStageback to summary
private DeferredResult<Object> adaptCompletionStage(CompletionStage<?> future)
adaptListenableFutureback to summary
private DeferredResult<Object> adaptListenableFuture(ListenableFuture<?> future)

References Deprecated

ListenableFuture is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Annotations
@SuppressWarnings:deprecation
handleReturnValueback to summary
public void handleReturnValue(Object returnValue, MethodParameter returnType, ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception

Implements org.springframework.web.method.support.HandlerMethodReturnValueHandler.handleReturnValue.

Doc from org.springframework.web.method.support.HandlerMethodReturnValueHandler.handleReturnValue.

Handle the given return value by adding attributes to the model and setting a view or setting the ModelAndViewContainer#setRequestHandled flag to true to indicate the response has been handled directly.

Parameters
returnValue:Object

the value returned from the handler method

returnType:MethodParameter

the type of the return value. This type must have previously been passed to supportsReturnType which must have returned true.

mavContainer:ModelAndViewContainer

the ModelAndViewContainer for the current request

webRequest:NativeWebRequest

the current request

Annotations
@SuppressWarnings:deprecation
@Override
Exceptions
Exception:
if the return value handling results in an error
supportsReturnTypeback to summary
public boolean supportsReturnType(MethodParameter returnType)

Implements org.springframework.web.method.support.HandlerMethodReturnValueHandler.supportsReturnType.

Doc from org.springframework.web.method.support.HandlerMethodReturnValueHandler.supportsReturnType.

Whether the given method return type is supported by this handler.

Parameters
returnType:MethodParameter

the method return type to check

Returns:boolean

true if this handler supports the supplied return type; false otherwise

Annotations
@SuppressWarnings:deprecation
@Override