|
|||||||||
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
public class InvocableHandlerMethod
Provides a method for invoking the handler method for a given request after resolving its method argument
values through registered HandlerMethodArgumentResolver
s.
Argument resolution often requires a WebDataBinder
for data binding or for type conversion.
Use the setDataBinderFactory(WebDataBinderFactory)
property to supply a binder factory to pass to
argument resolvers.
Use setHandlerMethodArgumentResolvers(HandlerMethodArgumentResolverComposite)
to customize
the list of argument resolvers.
Field Summary |
---|
Fields inherited from class org.springframework.web.method.HandlerMethod |
---|
logger |
Constructor Summary | |
---|---|
InvocableHandlerMethod(HandlerMethod handlerMethod)
Create an instance from a HandlerMethod . |
|
InvocableHandlerMethod(Object bean,
Method method)
Creates an instance from the given handler and method. |
|
InvocableHandlerMethod(Object bean,
String methodName,
Class<?>... parameterTypes)
Constructs a new handler method with the given bean instance, method name and parameters. |
Method Summary | |
---|---|
protected String |
getDetailedErrorMessage(String message)
Adds HandlerMethod details such as the controller type and method signature to the given error message. |
Object |
invokeForRequest(NativeWebRequest request,
ModelAndViewContainer mavContainer,
Object... providedArgs)
Invoke the method after resolving its argument values in the context of the given request. |
void |
setDataBinderFactory(WebDataBinderFactory dataBinderFactory)
Sets the WebDataBinderFactory to be passed to argument resolvers allowing them to create
a WebDataBinder for data binding and type conversion purposes. |
void |
setHandlerMethodArgumentResolvers(HandlerMethodArgumentResolverComposite argumentResolvers)
Set HandlerMethodArgumentResolver s to use to use for resolving method argument values. |
void |
setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDiscoverer)
Set the ParameterNameDiscoverer for resolving parameter names when needed (e.g. |
Methods inherited from class org.springframework.web.method.HandlerMethod |
---|
createWithResolvedBean, equals, getBean, getBeanType, getBridgedMethod, getMethod, getMethodAnnotation, getMethodParameters, getReturnType, getReturnValueType, hashCode, isVoid, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public InvocableHandlerMethod(Object bean, Method method)
public InvocableHandlerMethod(HandlerMethod handlerMethod)
HandlerMethod
.
public InvocableHandlerMethod(Object bean, String methodName, Class<?>... parameterTypes) throws NoSuchMethodException
bean
- the object beanmethodName
- the method nameparameterTypes
- the method parameter types
NoSuchMethodException
- when the method cannot be foundMethod Detail |
---|
public void setDataBinderFactory(WebDataBinderFactory dataBinderFactory)
WebDataBinderFactory
to be passed to argument resolvers allowing them to create
a WebDataBinder
for data binding and type conversion purposes.
dataBinderFactory
- the data binder factory.public void setHandlerMethodArgumentResolvers(HandlerMethodArgumentResolverComposite argumentResolvers)
HandlerMethodArgumentResolver
s to use to use for resolving method argument values.
public void setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDiscoverer)
Default is an LocalVariableTableParameterNameDiscoverer
instance.
public final Object invokeForRequest(NativeWebRequest request, ModelAndViewContainer mavContainer, Object... providedArgs) throws Exception
Argument
values are commonly resolved through HandlerMethodArgumentResolver
s. The provideArgs
parameter however may supply argument values to be used directly, i.e. without argument resolution.
Examples of provided argument values include a WebDataBinder
, a SessionStatus
, or
a thrown exception instance. Provided argument values are checked before argument resolvers.
request
- the current requestmavContainer
- the ModelAndViewContainer for this requestprovidedArgs
- "given" arguments matched by type, not resolved
Exception
- raised if no suitable argument resolver can be found, or the method raised an exceptionprotected String getDetailedErrorMessage(String message)
message
- error message to append the HandlerMethod details to
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |