spring-framework / org.springframework.web.method.support / InvocableHandlerMethod

InvocableHandlerMethod

open class InvocableHandlerMethod : HandlerMethod

Provides a method for invoking the handler method for a given request after resolving its method argument values through registered HandlerMethodArgumentResolvers.

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 to customize the list of argument resolvers.

Author
Rossen Stoyanchev

Author
Juergen Hoeller

Since
3.1

Constructors

<init>

InvocableHandlerMethod(handlerMethod: HandlerMethod)

Create an instance from a HandlerMethod.

InvocableHandlerMethod(bean: Any, method: Method)

Create an instance from a bean instance and a method.

InvocableHandlerMethod(bean: Any, methodName: String, vararg parameterTypes: Class<*>)

Construct a new handler method with the given bean instance, method name and parameters.

Functions

invokeForRequest

open fun invokeForRequest(request: NativeWebRequest, mavContainer: ModelAndViewContainer, vararg providedArgs: Any): Any

Invoke the method after resolving its argument values in the context of the given request.

Argument values are commonly resolved through HandlerMethodArgumentResolvers. The providedArgs 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.

setDataBinderFactory

open fun setDataBinderFactory(dataBinderFactory: WebDataBinderFactory): Unit

Set the WebDataBinderFactory to be passed to argument resolvers allowing them to create a WebDataBinder for data binding and type conversion purposes.

setHandlerMethodArgumentResolvers

open fun setHandlerMethodArgumentResolvers(argumentResolvers: HandlerMethodArgumentResolverComposite): Unit

Set HandlerMethodArgumentResolvers to use to use for resolving method argument values.

setParameterNameDiscoverer

open fun setParameterNameDiscoverer(parameterNameDiscoverer: ParameterNameDiscoverer): Unit

Set the ParameterNameDiscoverer for resolving parameter names when needed (e.g. default request attribute name).

Default is a org.springframework.core.DefaultParameterNameDiscoverer.

Inheritors

ServletInvocableHandlerMethod

open class ServletInvocableHandlerMethod : InvocableHandlerMethod

Extends 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.