Example usage for org.springframework.web.reactive.result.method InvocableHandlerMethod setArgumentResolvers

List of usage examples for org.springframework.web.reactive.result.method InvocableHandlerMethod setArgumentResolvers

Introduction

In this page you can find the example usage for org.springframework.web.reactive.result.method InvocableHandlerMethod setArgumentResolvers.

Prototype

public void setArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) 

Source Link

Document

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

Usage

From source file:org.springframework.web.reactive.result.method.annotation.ControllerMethodResolver.java

/**
 * Return an {@link InvocableHandlerMethod} for the given
 * {@code @RequestMapping} method initialized with argument resolvers.
 *///from w w w .j  a v a 2  s  . com
public InvocableHandlerMethod getRequestMappingMethod(HandlerMethod handlerMethod) {
    InvocableHandlerMethod invocable = new InvocableHandlerMethod(handlerMethod);
    invocable.setArgumentResolvers(this.requestMappingResolvers);
    invocable.setReactiveAdapterRegistry(this.reactiveAdapterRegistry);
    return invocable;
}

From source file:org.springframework.web.reactive.result.method.annotation.ControllerMethodResolver.java

private InvocableHandlerMethod createAttributeMethod(Object bean, Method method) {
    InvocableHandlerMethod invocable = new InvocableHandlerMethod(bean, method);
    invocable.setArgumentResolvers(this.modelAttributeResolvers);
    return invocable;
}

From source file:org.springframework.web.reactive.result.method.annotation.ControllerMethodResolver.java

/**
 * Find an {@code @ExceptionHandler} method in {@code @ControllerAdvice}
 * components or in the controller of the given {@code @RequestMapping} method.
 *///from   w  w w.  ja v a 2  s . c  o  m
@Nullable
public InvocableHandlerMethod getExceptionHandlerMethod(Throwable ex, HandlerMethod handlerMethod) {

    Class<?> handlerType = handlerMethod.getBeanType();

    // Controller-local first...
    Object targetBean = handlerMethod.getBean();
    Method targetMethod = this.exceptionHandlerCache
            .computeIfAbsent(handlerType, ExceptionHandlerMethodResolver::new).resolveMethodByThrowable(ex);

    if (targetMethod == null) {
        // Global exception handlers...
        for (ControllerAdviceBean advice : this.exceptionHandlerAdviceCache.keySet()) {
            if (advice.isApplicableToBeanType(handlerType)) {
                targetBean = advice.resolveBean();
                targetMethod = this.exceptionHandlerAdviceCache.get(advice).resolveMethodByThrowable(ex);
                if (targetMethod != null) {
                    break;
                }
            }
        }
    }

    if (targetMethod == null) {
        return null;
    }

    InvocableHandlerMethod invocable = new InvocableHandlerMethod(targetBean, targetMethod);
    invocable.setArgumentResolvers(this.exceptionHandlerResolvers);
    return invocable;
}