void and String interpreting them
as view name reference. As of 4.2, it also handles general CharSequence
types, e.g. StringBuilder or Groovy's GString, as view names.
A null return value, either due to a void return type or
as the actual return value is left as-is allowing the configured
RequestToViewNameTranslator to select a view name by convention.
A String return value can be interpreted in more than one way depending on
the presence of annotations like @ModelAttribute or @ResponseBody.
Therefore, this handler should be configured after the handlers that support these
annotations.
| 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
| |
| ViewNameMethodReturnValueHandler | back to summary |
|---|---|
| public ViewNameMethodReturnValueHandler() | |
| getRedirectPatterns | back to summary |
|---|---|
| public String[] getRedirectPatterns() 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 View that recognizes the prefix as well.
| |
| 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.
| |