spring-framework / org.springframework.web.servlet.mvc.method.annotation / ServletInvocableHandlerMethod

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.

Author
Rossen Stoyanchev

Author
Juergen Hoeller

Since
3.1

Constructors

<init>

ServletInvocableHandlerMethod(handler: Any, method: Method)

Creates an instance from the given handler and method.

ServletInvocableHandlerMethod(handlerMethod: HandlerMethod)

Create an instance from a HandlerMethod.

Functions

invokeAndHandle

open fun invokeAndHandle(webRequest: ServletWebRequest, mavContainer: ModelAndViewContainer, vararg providedArgs: Any): Unit

Invoke the method and handle the return value through one of the configured HandlerMethodReturnValueHandlers.

setHandlerMethodReturnValueHandlers

open fun setHandlerMethodReturnValueHandlers(returnValueHandlers: HandlerMethodReturnValueHandlerComposite): Unit

Register HandlerMethodReturnValueHandler instances to use to handle return values.

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