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.
A nested subclass of |
| private class | ServletInvocableHandlerMethod.
MethodParameter subclass based on the actual return value type or if
that's null falling back on the generic type within the declared async
return type, e.g. Foo instead of |
| Modifier and Type | Field and Description |
|---|---|
| private static final Method | |
| private HandlerMethodReturnValueHandlerComposite |
| Access | Constructor and Description |
|---|---|
| public | ServletInvocableHandlerMethod(Object handler, Method method)
Creates an instance from the given handler and method. |
| public | ServletInvocableHandlerMethod(Object handler, Method method, MessageSource messageSource)
Variant of |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private String | |
| public void | invokeAndHandle(ServletWebRequest
the current request webRequest, ModelAndViewContainer the ModelAndViewContainer for this request mavContainer, Object... "given" arguments matched by type (not resolved) providedArgs)Invoke the method and handle the return value through one of the
configured |
| private boolean | |
| public void | setHandlerMethodReturnValueHandlers(HandlerMethodReturnValueHandlerComposite returnValueHandlers)
Register |
| private void | setResponseStatus(ServletWebRequest webRequest)
Set the response status according to the |
| pack-priv ServletInvocableHandlerMethod | wrapConcurrentResult(Object result)
Create a nested ServletInvocableHandlerMethod subclass that returns the given value (or raises an Exception if the value is one) rather than actually invoking the controller method. |
| CALLABLE_METHOD | back to summary |
|---|---|
| private static final Method CALLABLE_METHOD | |
| returnValueHandlers | back to summary |
|---|---|
| private HandlerMethodReturnValueHandlerComposite returnValueHandlers
| |
| ServletInvocableHandlerMethod | back to summary |
|---|---|
| public ServletInvocableHandlerMethod(Object handler, Method method) Creates an instance from the given handler and method. | |
| ServletInvocableHandlerMethod | back to summary |
|---|---|
| public ServletInvocableHandlerMethod(Object handler, Method method, MessageSource messageSource) Variant of
| |
| ServletInvocableHandlerMethod | back to summary |
|---|---|
| public ServletInvocableHandlerMethod(HandlerMethod handlerMethod) Create an instance from a | |
| disableContentCachingIfNecessary | back to summary |
|---|---|
| private void disableContentCachingIfNecessary(ServletWebRequest webRequest) | |
| formatErrorForReturnValue | back to summary |
|---|---|
| private String formatErrorForReturnValue(Object returnValue) | |
| invokeAndHandle | back to summary |
|---|---|
| public void invokeAndHandle(ServletWebRequest webRequest, ModelAndViewContainer mavContainer, Object... providedArgs) throws Exception Invoke the method and handle the return value through one of the
configured
| |
| isRequestNotModified | back to summary |
|---|---|
| private boolean isRequestNotModified(ServletWebRequest webRequest) Does the given request qualify as "not modified"? | |
| setHandlerMethodReturnValueHandlers | back to summary |
|---|---|
| public void setHandlerMethodReturnValueHandlers(HandlerMethodReturnValueHandlerComposite returnValueHandlers) Register | |
| setResponseStatus | back to summary |
|---|---|
| private void setResponseStatus(ServletWebRequest webRequest) throws IOException Set the response status according to the | |
| wrapConcurrentResult | back to summary |
|---|---|
| pack-priv ServletInvocableHandlerMethod wrapConcurrentResult(Object result) Create a nested ServletInvocableHandlerMethod subclass that returns the given value (or raises an Exception if the value is one) rather than actually invoking the controller method. This is useful when processing async return values (e.g. Callable, DeferredResult, ListenableFuture). | |
ServletInvocableHandlerMethod that uses a
simple Callable instead of the original controller as the handler in
order to return the fixed (concurrent) result value given to it. Effectively
"resumes" processing with the asynchronously produced return value.
| Modifier and Type | Field and Description |
|---|---|
| private final MethodParameter |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Class | getBeanType()
Overrides org. Bridge to actual controller type-level annotations. |
| public <A extends Annotation> A | getMethodAnnotation(Class<A>
the annotation type to look for annotationType)Overrides org. Bridge to controller method-level annotations. |
| public MethodParameter | getReturnValueType(Object returnValue)
Overrides org. Bridge to actual return value or generic type within the declared
async return type, e.g. Foo instead of |
| public <A extends Annotation> boolean | hasMethodAnnotation(Class<A>
the annotation type to look for annotationType)Overrides org. Bridge to controller method-level annotations. |
| returnType | back to summary |
|---|---|
| private final MethodParameter returnType | |
| ConcurrentResultHandlerMethod | back to summary |
|---|---|
| public ConcurrentResultHandlerMethod(Object result, ServletInvocableHandlerMethod. | |
| getBeanType | back to summary |
|---|---|
| public Class Overrides org. Bridge to actual controller type-level annotations.
| |
| getMethodAnnotation | back to summary |
|---|---|
| public <A extends Annotation> A getMethodAnnotation(Class<A> annotationType) Overrides org. Bridge to controller method-level annotations.
| |
| getReturnValueType | back to summary |
|---|---|
| public MethodParameter getReturnValueType(Object returnValue) Overrides org. Bridge to actual return value or generic type within the declared
async return type, e.g. Foo instead of
| |
| hasMethodAnnotation | back to summary |
|---|---|
| public <A extends Annotation> boolean hasMethodAnnotation(Class<A> annotationType) Overrides org. Bridge to controller method-level annotations.
| |
DeferredResult<Foo>.
| Modifier and Type | Field and Description |
|---|---|
| private final ResolvableType | |
| private final Object |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public ServletInvocableHandlerMethod. | clone()
Overrides org. Creates and returns a copy of this object. |
| public Type | getGenericParameterType()
Overrides org. Return the generic type of the method/constructor parameter. |
| public Class | getParameterType()
Overrides org. Return the type of the method/constructor parameter. |
| public <T extends Annotation> boolean | hasMethodAnnotation(Class<T>
the annotation type to look for annotationType)Overrides org. Return whether the method/constructor is annotated with the given type. |
| returnType | back to summary |
|---|---|
| private final ResolvableType returnType | |
| returnValue | back to summary |
|---|---|
| private final Object returnValue
| |
| ConcurrentResultMethodParameter | back to summary |
|---|---|
| public ConcurrentResultMethodParameter(Object returnValue) | |
| ConcurrentResultMethodParameter | back to summary |
|---|---|
| public ConcurrentResultMethodParameter(ServletInvocableHandlerMethod. | |
| clone | back to summary |
|---|---|
| public ServletInvocableHandlerMethod. Overrides org. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| getGenericParameterType | back to summary |
|---|---|
| public Type getGenericParameterType() Overrides org. Doc from org. Return the generic type of the method/constructor parameter. | |
| getParameterType | back to summary |
|---|---|
| public Class Overrides org. Doc from org. Return the type of the method/constructor parameter. | |
| hasMethodAnnotation | back to summary |
|---|---|
| public <T extends Annotation> boolean hasMethodAnnotation(Class<T> annotationType) Overrides org. Doc from org. Return whether the method/constructor is annotated with the given type. | |