Top Description Inners Fields Constructors Methods
org.springframework.web.reactive.result.method

public Class InvocableHandlerMethod

extends HandlerMethod
Class Inheritance
Imports
java.lang.reflect.InvocationTargetException, .Method, .Modifier, .ParameterizedType, .Type, java.util.ArrayList, .List, .Map, java.util.stream.Stream, kotlin.Unit, kotlin.coroutines.CoroutineContext, kotlin.jvm.JvmClassMappingKt, kotlin.reflect.KClass, kotlin.reflect.KFunction, kotlin.reflect.KParameter, kotlin.reflect.jvm.KCallablesJvm, kotlin.reflect.jvm.ReflectJvmMapping, reactor.core.publisher.Mono, org.springframework.core.CoroutinesUtils, .DefaultParameterNameDiscoverer, .KotlinDetector, .MethodParameter, .ParameterNameDiscoverer, .ReactiveAdapter, .ReactiveAdapterRegistry, org.springframework.http.HttpStatusCode, org.springframework.http.server.reactive.ServerHttpResponse, org.springframework.lang.Nullable, org.springframework.util.Assert, .CollectionUtils, .ObjectUtils, .ReflectionUtils, org.springframework.validation.method.MethodValidator, org.springframework.web.method.HandlerMethod, org.springframework.web.reactive.BindingContext, .HandlerResult, org.springframework.web.server.ServerWebExchange

Extension of HandlerMethod that invokes the underlying method with argument values resolved from the current HTTP request through a list of HandlerMethodArgumentResolver.
Authors
Rossen Stoyanchev, Juergen Hoeller, Sebastien Deleuze
Since
5.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
InvocableHandlerMethod.KotlinDelegate

Inner class to avoid a hard dependency on Kotlin at runtime.

Field Summary

Modifier and TypeField and Description
private static final ReflectionUtils.MethodFilter
private static final Mono<Object[]>
private static final Class<?>[]
private MethodValidator
private static final Object
private ParameterNameDiscoverer
private ReactiveAdapterRegistry
private final HandlerMethodArgumentResolverComposite
private Class<?>[]
Inherited from org.springframework.web.method.HandlerMethod:
logger

Constructor Summary

AccessConstructor and Description
public
InvocableHandlerMethod(HandlerMethod handlerMethod)

Create an instance from a HandlerMethod.

public
InvocableHandlerMethod(Object bean, Method method)

Create an instance from a bean instance and a method.

Method Summary

Modifier and TypeMethod and Description
private Mono<Object[]>
getMethodArgumentValues(ServerWebExchange exchange, BindingContext bindingContext, Object... providedArgs)

public ParameterNameDiscoverer
getParameterNameDiscoverer()

Return the configured parameter name discoverer.

public List<HandlerMethodArgumentResolver>
getResolvers()

Return the configured argument resolvers.

public Mono<HandlerResult>

Returns:

a Mono with a HandlerResult
invoke
(ServerWebExchange
the current exchange
exchange
,
BindingContext
the binding context to use
bindingContext
,
Object...
optional list of argument values to match by type
providedArgs
)

Invoke the method for the given exchange.

private static boolean
private boolean
private void
public void
setArgumentResolvers(List<? extends HandlerMethodArgumentResolver> resolvers)

Configure the argument resolvers to use for resolving method argument values against a ServerWebExchange.

public void
setMethodValidator(MethodValidator methodValidator)

Set the MethodValidator to perform method validation with if the controller method shouldValidateArguments() or shouldValidateReturnValue().

public void
setParameterNameDiscoverer(ParameterNameDiscoverer nameDiscoverer)

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

public void
setReactiveAdapterRegistry(ReactiveAdapterRegistry registry)

Configure a reactive adapter registry.

Inherited from org.springframework.web.method.HandlerMethod:
assertTargetBeancreateWithResolvedBeancreateWithValidateFlagsequalsformatInvokeErrorgetBeangetBeanTypegetContainingClassgetResolvedFromHandlerMethodgetResponseStatusgetResponseStatusReasongetShortLogMessagehashCodeshouldValidateArgumentsshouldValidateReturnValuetoString

Field Detail

boxImplFilterback to summary
private static final ReflectionUtils.MethodFilter boxImplFilter
EMPTY_ARGSback to summary
private static final Mono<Object[]> EMPTY_ARGS
EMPTY_GROUPSback to summary
private static final Class<?>[] EMPTY_GROUPS
methodValidatorback to summary
private MethodValidator methodValidator
Annotations
@Nullable
NO_ARG_VALUEback to summary
private static final Object NO_ARG_VALUE
parameterNameDiscovererback to summary
private ParameterNameDiscoverer parameterNameDiscoverer
reactiveAdapterRegistryback to summary
private ReactiveAdapterRegistry reactiveAdapterRegistry
resolversback to summary
private final HandlerMethodArgumentResolverComposite resolvers
validationGroupsback to summary
private Class<?>[] validationGroups

Constructor Detail

InvocableHandlerMethodback to summary
public InvocableHandlerMethod(HandlerMethod handlerMethod)

Create an instance from a HandlerMethod.

InvocableHandlerMethodback to summary
public InvocableHandlerMethod(Object bean, Method method)

Create an instance from a bean instance and a method.

Method Detail

getMethodArgumentValuesback to summary
private Mono<Object[]> getMethodArgumentValues(ServerWebExchange exchange, BindingContext bindingContext, Object... providedArgs)
getParameterNameDiscovererback to summary
public ParameterNameDiscoverer getParameterNameDiscoverer()

Return the configured parameter name discoverer.

getResolversback to summary
public List<HandlerMethodArgumentResolver> getResolvers()

Return the configured argument resolvers.

invokeback to summary
public Mono<HandlerResult> invoke(ServerWebExchange exchange, BindingContext bindingContext, Object... providedArgs)

Invoke the method for the given exchange.

Parameters
exchange:ServerWebExchange

the current exchange

bindingContext:BindingContext

the binding context to use

providedArgs:Object[]

optional list of argument values to match by type

Returns:Mono<HandlerResult>

a Mono with a HandlerResult

Annotations
@SuppressWarnings:unchecked
isAsyncVoidReturnTypeback to summary
private static boolean isAsyncVoidReturnType(MethodParameter returnType, ReactiveAdapter adapter)
isResponseHandledback to summary
private boolean isResponseHandled(Object[] args, ServerWebExchange exchange)
logArgumentErrorIfNecessaryback to summary
private void logArgumentErrorIfNecessary(ServerWebExchange exchange, MethodParameter parameter, Throwable ex)
setArgumentResolversback to summary
public void setArgumentResolvers(List<? extends HandlerMethodArgumentResolver> resolvers)

Configure the argument resolvers to use for resolving method argument values against a ServerWebExchange.

setMethodValidatorback to summary
public void setMethodValidator(MethodValidator methodValidator)

Set the MethodValidator to perform method validation with if the controller method shouldValidateArguments() or shouldValidateReturnValue().

Since
6.1
setParameterNameDiscovererback to summary
public void setParameterNameDiscoverer(ParameterNameDiscoverer nameDiscoverer)

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

Default is a DefaultParameterNameDiscoverer.

setReactiveAdapterRegistryback to summary
public void setReactiveAdapterRegistry(ReactiveAdapterRegistry registry)

Configure a reactive adapter registry. This is needed for cases where the response is fully handled within the controller in combination with an async void return value.

By default this is a ReactiveAdapterRegistry with default settings.

org.springframework.web.reactive.result.method back to summary

private Class InvocableHandlerMethod.KotlinDelegate

extends Object
Class Inheritance
  • java.lang.Object
  • org.springframework.web.reactive.result.method.InvocableHandlerMethod.KotlinDelegate

Inner class to avoid a hard dependency on Kotlin at runtime.

Field Summary

Modifier and TypeField and Description
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Object
invokeFunction(Method method, Object target, Object[] args, boolean isSuspendingFunction, ServerWebExchange exchange)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

COROUTINE_CONTEXT_ATTRIBUTEback to summary
private static final String COROUTINE_CONTEXT_ATTRIBUTE

Constructor Detail

KotlinDelegateback to summary
private KotlinDelegate()

Method Detail

invokeFunctionback to summary
public static Object invokeFunction(Method method, Object target, Object[] args, boolean isSuspendingFunction, ServerWebExchange exchange) throws InvocationTargetException, IllegalAccessException
Annotations
@Nullable
@SuppressWarnings:deprecation