public class HandlerMethodReturnValueHandlerComposite extends Object implements HandlerMethodReturnValueHandler
HandlerMethodReturnValueHandlers.
Previously resolved return types are cached for faster lookups.| Constructor and Description |
|---|
HandlerMethodReturnValueHandlerComposite() |
| Modifier and Type | Method and Description |
|---|---|
HandlerMethodReturnValueHandlerComposite |
addHandler(HandlerMethodReturnValueHandler returnValuehandler)
Add the given
HandlerMethodReturnValueHandler. |
HandlerMethodReturnValueHandlerComposite |
addHandlers(List<? extends HandlerMethodReturnValueHandler> returnValueHandlers)
Add the given
HandlerMethodReturnValueHandlers. |
List<HandlerMethodReturnValueHandler> |
getHandlers()
Return a read-only list with the registered handlers, or an empty list.
|
void |
handleReturnValue(Object returnValue,
org.springframework.core.MethodParameter returnType,
ModelAndViewContainer mavContainer,
NativeWebRequest webRequest)
Iterate over registered
HandlerMethodReturnValueHandlers and invoke the one that supports it. |
boolean |
supportsReturnType(org.springframework.core.MethodParameter returnType)
Whether the given method return type is supported by any registered
HandlerMethodReturnValueHandler. |
protected final Log logger
public HandlerMethodReturnValueHandlerComposite()
public List<HandlerMethodReturnValueHandler> getHandlers()
public boolean supportsReturnType(org.springframework.core.MethodParameter returnType)
HandlerMethodReturnValueHandler.supportsReturnType in interface HandlerMethodReturnValueHandlerreturnType - the method return type to checktrue if this handler supports the supplied return type;
false otherwisepublic void handleReturnValue(Object returnValue, org.springframework.core.MethodParameter returnType, ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception
HandlerMethodReturnValueHandlers and invoke the one that supports it.handleReturnValue in interface HandlerMethodReturnValueHandlerreturnValue - the value returned from the handler methodreturnType - the type of the return value. This type must have
previously been passed to
HandlerMethodReturnValueHandler.supportsReturnType(org.springframework.core.MethodParameter)
and it must have returned truemavContainer - the ModelAndViewContainer for the current requestwebRequest - the current requestIllegalStateException - if no suitable HandlerMethodReturnValueHandler is found.Exception - if the return value handling results in an errorpublic HandlerMethodReturnValueHandlerComposite addHandler(HandlerMethodReturnValueHandler returnValuehandler)
HandlerMethodReturnValueHandler.public HandlerMethodReturnValueHandlerComposite addHandlers(List<? extends HandlerMethodReturnValueHandler> returnValueHandlers)
HandlerMethodReturnValueHandlers.