ModelAndView copying view and model
information to the ModelAndViewContainer.
If the return value is null, the
ModelAndViewContainer#setRequestHandled(boolean) flag is set to
true 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.
| Modifier and Type | Field and Description |
|---|---|
| private String[] |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public String[] | |
| 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
|
| protected boolean | Returns: "true" if the given view name is recognized as a redirect view reference; "false" otherwise.the view name to check, never viewName)nullWhether the given view name is a redirect view reference. |
| public void | setRedirectPatterns(String... redirectPatterns)
Configure one more simple patterns (as described in |
| public boolean | supportsReturnType(MethodParameter
the method return type to check returnType)Implements org. Whether the given method return type is supported by this handler. |
| redirectPatterns | back to summary |
|---|---|
| private String[] redirectPatterns
| |
| ModelAndViewMethodReturnValueHandler | back to summary |
|---|---|
| public ModelAndViewMethodReturnValueHandler() | |
| getRedirectPatterns | back to summary |
|---|---|
| public String[] getRedirectPatterns() Return the configured redirect patterns, if any.
| |
| 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
| |
| isRedirectViewName | back to summary |
|---|---|
| protected boolean isRedirectViewName(String viewName) Whether the given view name is a redirect view reference. The default implementation checks the configured redirect patterns and also if the view name starts with the "redirect:" prefix.
| |
| setRedirectPatterns | back to summary |
|---|---|
| public void setRedirectPatterns(String... redirectPatterns) Configure one more simple patterns (as described in Note that simply configuring this property will not make a custom redirect prefix work.
There must be a custom
| |
| supportsReturnType | back to summary |
|---|---|
| public boolean supportsReturnType(MethodParameter returnType) Implements org. Doc from org. Whether the given method return type is supported by this handler.
| |