Example usage for org.springframework.web.reactive BindingContext getModel

List of usage examples for org.springframework.web.reactive BindingContext getModel

Introduction

In this page you can find the example usage for org.springframework.web.reactive BindingContext getModel.

Prototype

public Model getModel() 

Source Link

Document

Return the default model.

Usage

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

private Mono<HandlerResult> handleException(Throwable exception, HandlerMethod handlerMethod,
        BindingContext bindingContext, ServerWebExchange exchange) {

    Assert.state(this.methodResolver != null, "Not initialized");

    InvocableHandlerMethod invocable = this.methodResolver.getExceptionHandlerMethod(exception, handlerMethod);
    if (invocable != null) {
        try {/*  ww w.  ja  v  a 2 s  .c  o m*/
            if (logger.isDebugEnabled()) {
                logger.debug("Invoking @ExceptionHandler method: " + invocable.getMethod());
            }
            bindingContext.getModel().asMap().clear();
            Throwable cause = exception.getCause();
            if (cause != null) {
                return invocable.invoke(exchange, bindingContext, exception, cause, handlerMethod);
            } else {
                return invocable.invoke(exchange, bindingContext, exception, handlerMethod);
            }
        } catch (Throwable invocationEx) {
            if (logger.isWarnEnabled()) {
                logger.warn("Failed to invoke: " + invocable.getMethod(), invocationEx);
            }
        }
    }
    return Mono.error(exception);
}