org.springframework.web.servlet.mvc.method.annotation
Class ServletInvocableHandlerMethod
java.lang.Object
org.springframework.web.method.HandlerMethod
org.springframework.web.method.support.InvocableHandlerMethod
org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod
public class ServletInvocableHandlerMethod
- extends InvocableHandlerMethod
Extends InvocableHandlerMethod
with the ability to handle the value returned from the method through
a registered HandlerMethodArgumentResolver
that supports the given return value type.
Return value handling may include writing to the response or updating the ModelAndViewContainer
structure.
If the underlying method has a ResponseStatus
instruction, the status on the response is set
accordingly after the method is invoked but before the return value is handled.
- Since:
- 3.1
- Author:
- Rossen Stoyanchev
- See Also:
invokeAndHandle(NativeWebRequest, ModelAndViewContainer, Object...)
Methods inherited from class org.springframework.web.method.HandlerMethod |
createWithResolvedBean, equals, getBean, getBeanType, getBridgedMethod, getMethod, getMethodAnnotation, getMethodParameters, getReturnType, hashCode, isVoid, toString |
ServletInvocableHandlerMethod
public ServletInvocableHandlerMethod(Object handler,
Method method)
- Creates a
ServletInvocableHandlerMethod
instance with the given bean and method.
- Parameters:
handler
- the object handlermethod
- the method
setHandlerMethodReturnValueHandlers
public void setHandlerMethodReturnValueHandlers(HandlerMethodReturnValueHandlerComposite returnValueHandlers)
invokeAndHandle
public final void invokeAndHandle(NativeWebRequest request,
ModelAndViewContainer mavContainer,
Object... providedArgs)
throws Exception
- Invokes the method and handles the return value through a registered
HandlerMethodReturnValueHandler
.
Return value handling may be skipped entirely when the method returns null
(also possibly due
to a void
return type) and one of the following additional conditions is true:
After the return value is handled, callers of this method can use the ModelAndViewContainer
to gain access to model attributes, view selection choices, and to check if view resolution is even needed.
- Parameters:
request
- the current requestmavContainer
- the ModelAndViewContainer
for the current requestprovidedArgs
- argument values to try to use without the need for view resolution
- Throws:
Exception