true for
all return types).
The return value is handled either with a ModelAndViewResolver
or otherwise by regarding it as a model attribute if it is a non-simple
type. If neither of these succeeds (essentially simple type other than
String), UnsupportedOperationException is raised.
Note
This class is primarily needed to support
ModelAndViewResolver, which unfortunately cannot be properly
adapted to the HandlerMethodReturnValueHandler contract since the
HandlerMethodReturnValueHandler#supportsReturnType method
cannot be implemented. Hence ModelAndViewResolvers are limited
to always being invoked at the end after all other return value
handlers have been given a chance. It is recommended to re-implement
a ModelAndViewResolver as HandlerMethodReturnValueHandler,
which also provides better access to the return type and method information.
| Modifier and Type | Field and Description |
|---|---|
| private final List | |
| private final ModelAttributeMethodProcessor |
| Access | Constructor and Description |
|---|---|
| public | ModelAndViewResolverMethodReturnValueHandler(List<ModelAndViewResolver> mavResolvers)
Create a new instance. |
| Modifier and Type | Method and Description |
|---|---|
| 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 returnType, ModelAndViewContainer supportsReturnType which must
have returned true.the ModelAndViewContainer for the current request mavContainer, NativeWebRequest the current request webRequest)Implements org. Handle the given return value by adding attributes to the model and
setting a view or setting the
|
| public boolean | supportsReturnType(MethodParameter
the method return type to check returnType)Implements org. Always returns |
| mavResolvers | back to summary |
|---|---|
| private final List<ModelAndViewResolver> mavResolvers
| |
| modelAttributeProcessor | back to summary |
|---|---|
| private final ModelAttributeMethodProcessor modelAttributeProcessor | |
| ModelAndViewResolverMethodReturnValueHandler | back to summary |
|---|---|
| public ModelAndViewResolverMethodReturnValueHandler(List<ModelAndViewResolver> mavResolvers) Create a new instance. | |
| handleReturnValue | back to summary |
|---|---|
| public void handleReturnValue(Object returnValue, MethodParameter returnType, ModelAndViewContainer mavContainer, NativeWebRequest webRequest) throws Exception Implements org. Doc from org. Handle the given return value by adding attributes to the model and
setting a view or setting the
| |
| supportsReturnType | back to summary |
|---|---|
| public boolean supportsReturnType(MethodParameter returnType) Implements org. Always returns
| |