|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
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.
invokeAndHandle(NativeWebRequest, ModelAndViewContainer, Object...)
Field Summary | |
---|---|
private java.lang.String |
responseReason
|
private HttpStatus |
responseStatus
|
private HandlerMethodReturnValueHandlerComposite |
returnValueHandlers
|
Fields inherited from class org.springframework.web.method.HandlerMethod |
---|
logger |
Constructor Summary | |
---|---|
ServletInvocableHandlerMethod(java.lang.Object handler,
java.lang.reflect.Method method)
Creates a ServletInvocableHandlerMethod instance with the given bean and method. |
Method Summary | |
---|---|
private java.lang.String |
getReturnValueHandlingErrorMessage(java.lang.String message,
java.lang.Object returnValue)
|
private boolean |
hasResponseStatus()
Does this method have the response status instruction? |
void |
invokeAndHandle(NativeWebRequest request,
ModelAndViewContainer mavContainer,
java.lang.Object... providedArgs)
Invokes the method and handles the return value through a registered HandlerMethodReturnValueHandler . |
private boolean |
isRequestNotModified(NativeWebRequest request)
Does the given request qualify as "not modified"? |
void |
setHandlerMethodReturnValueHandlers(HandlerMethodReturnValueHandlerComposite returnValueHandlers)
|
private void |
setResponseStatus(ServletWebRequest webRequest)
Set the response status according to the ResponseStatus annotation. |
Methods inherited from class org.springframework.web.method.support.InvocableHandlerMethod |
---|
getDetailedErrorMessage, invokeForRequest, setDataBinderFactory, setHandlerMethodArgumentResolvers, setParameterNameDiscoverer |
Methods inherited from class org.springframework.web.method.HandlerMethod |
---|
createWithResolvedBean, equals, getBean, getBeanType, getBridgedMethod, getMethod, getMethodAnnotation, getMethodParameters, getReturnType, hashCode, isVoid, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private HttpStatus responseStatus
private java.lang.String responseReason
private HandlerMethodReturnValueHandlerComposite returnValueHandlers
Constructor Detail |
---|
public ServletInvocableHandlerMethod(java.lang.Object handler, java.lang.reflect.Method method)
ServletInvocableHandlerMethod
instance with the given bean and method.
handler
- the object handlermethod
- the methodMethod Detail |
---|
public void setHandlerMethodReturnValueHandlers(HandlerMethodReturnValueHandlerComposite returnValueHandlers)
public final void invokeAndHandle(NativeWebRequest request, ModelAndViewContainer mavContainer, java.lang.Object... providedArgs) throws java.lang.Exception
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:
HandlerMethodArgumentResolver
has set the ModelAndViewContainer.setRequestHandled(boolean)
flag to false
-- e.g. method arguments providing access to the response.
ServletWebRequest.checkNotModified(long)
and ServletWebRequest.checkNotModified(String)
. In this case a response with "not modified" response
headers will be automatically generated without the need for return value handling.
ResponseStatus
instruction.
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.
request
- the current requestmavContainer
- the ModelAndViewContainer
for the current requestprovidedArgs
- argument values to try to use without the need for view resolution
java.lang.Exception
private java.lang.String getReturnValueHandlingErrorMessage(java.lang.String message, java.lang.Object returnValue)
private void setResponseStatus(ServletWebRequest webRequest) throws java.io.IOException
ResponseStatus
annotation.
java.io.IOException
private boolean isRequestNotModified(NativeWebRequest request)
ServletWebRequest.checkNotModified(long)
,
ServletWebRequest.checkNotModified(String)
private boolean hasResponseStatus()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |