List of usage examples for org.springframework.web.reactive.result.method.annotation InitBinderBindingContext InitBinderBindingContext
InitBinderBindingContext(@Nullable WebBindingInitializer initializer, List<SyncInvocableHandlerMethod> binderMethods)
From source file:org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter.java
@Override public Mono<HandlerResult> handle(ServerWebExchange exchange, Object handler) { HandlerMethod handlerMethod = (HandlerMethod) handler; Assert.state(this.methodResolver != null && this.modelInitializer != null, "Not initialized"); InitBinderBindingContext bindingContext = new InitBinderBindingContext(getWebBindingInitializer(), this.methodResolver.getInitBinderMethods(handlerMethod)); InvocableHandlerMethod invocableMethod = this.methodResolver.getRequestMappingMethod(handlerMethod); Function<Throwable, Mono<HandlerResult>> exceptionHandler = ex -> handleException(ex, handlerMethod, bindingContext, exchange);//from w ww . j a v a 2s .co m return this.modelInitializer.initModel(handlerMethod, bindingContext, exchange) .then(Mono.defer(() -> invocableMethod.invoke(exchange, bindingContext))) .doOnNext(result -> result.setExceptionHandler(exceptionHandler)) .doOnNext(result -> bindingContext.saveModel()).onErrorResume(exceptionHandler); }