public class ServletInvocableHandlerMethod extends InvocableHandlerMethod
InvocableHandlerMethod
with the ability to handle return
values through a registered HandlerMethodReturnValueHandler
and
also supports setting the response status based on a method-level
@ResponseStatus
annotation.
A null
return value (including void) may be interpreted as the
end of request processing in combination with a @ResponseStatus
annotation, a not-modified check condition
(see ServletWebRequest.checkNotModified(long)
), or
a method argument that provides access to the response stream.
Modifier and Type | Class and Description |
---|---|
private class |
ServletInvocableHandlerMethod.CallableHandlerMethod
A sub-class of
HandlerMethod that invokes the given Callable
instead of the target controller method. |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
responseReason |
private HttpStatus |
responseStatus |
private HandlerMethodReturnValueHandlerComposite |
returnValueHandlers |
logger
Constructor and Description |
---|
ServletInvocableHandlerMethod(HandlerMethod handlerMethod)
Create an instance from a
HandlerMethod . |
ServletInvocableHandlerMethod(java.lang.Object handler,
java.lang.reflect.Method method)
Creates an instance from the given handler and method.
|
Modifier and Type | Method and Description |
---|---|
private java.lang.String |
getReturnValueHandlingErrorMessage(java.lang.String message,
java.lang.Object returnValue) |
private boolean |
hasResponseStatus()
Does this method have the response status instruction?
|
private void |
initResponseStatus() |
void |
invokeAndHandle(ServletWebRequest webRequest,
ModelAndViewContainer mavContainer,
java.lang.Object... providedArgs)
Invokes the method and handles the return value through a registered
HandlerMethodReturnValueHandler . |
private boolean |
isRequestNotModified(ServletWebRequest webRequest)
Does the given request qualify as "not modified"?
|
void |
setHandlerMethodReturnValueHandlers(HandlerMethodReturnValueHandlerComposite returnValueHandlers)
Register
HandlerMethodReturnValueHandler instances to use to
handle return values. |
private void |
setResponseStatus(ServletWebRequest webRequest)
Set the response status according to the
ResponseStatus annotation. |
(package private) ServletInvocableHandlerMethod |
wrapConcurrentResult(java.lang.Object result)
Create a ServletInvocableHandlerMethod that will return the given value from an
async operation instead of invoking the controller method again.
|
getDetailedErrorMessage, invokeForRequest, setDataBinderFactory, setHandlerMethodArgumentResolvers, setParameterNameDiscoverer
createWithResolvedBean, equals, getBean, getBeanType, getBridgedMethod, getMethod, getMethodAnnotation, getMethodParameters, getReturnType, getReturnValueType, hashCode, isVoid, toString
private HttpStatus responseStatus
private java.lang.String responseReason
private HandlerMethodReturnValueHandlerComposite returnValueHandlers
public ServletInvocableHandlerMethod(java.lang.Object handler, java.lang.reflect.Method method)
public ServletInvocableHandlerMethod(HandlerMethod handlerMethod)
HandlerMethod
.private void initResponseStatus()
public void setHandlerMethodReturnValueHandlers(HandlerMethodReturnValueHandlerComposite returnValueHandlers)
HandlerMethodReturnValueHandler
instances to use to
handle return values.public final void invokeAndHandle(ServletWebRequest webRequest, ModelAndViewContainer mavContainer, java.lang.Object... providedArgs) throws java.lang.Exception
HandlerMethodReturnValueHandler
.webRequest
- the current requestmavContainer
- the ModelAndViewContainer for this requestprovidedArgs
- "given" arguments matched by type, not resolvedjava.lang.Exception
private void setResponseStatus(ServletWebRequest webRequest) throws java.io.IOException
ResponseStatus
annotation.java.io.IOException
private boolean isRequestNotModified(ServletWebRequest webRequest)
private boolean hasResponseStatus()
private java.lang.String getReturnValueHandlingErrorMessage(java.lang.String message, java.lang.Object returnValue)
ServletInvocableHandlerMethod wrapConcurrentResult(java.lang.Object result)