use of org.springframework.web.reactive.function.server.ServerRequest in project spring-framework by spring-projects.
the class HandlerFunctionAdapter method handle.
@Override
public Mono<HandlerResult> handle(ServerWebExchange exchange, Object handler) {
HandlerFunction<?> handlerFunction = (HandlerFunction<?>) handler;
ServerRequest request = exchange.<ServerRequest>getAttribute(RouterFunctions.REQUEST_ATTRIBUTE).orElseThrow(() -> new IllegalStateException("Could not find ServerRequest in exchange attributes"));
return handlerFunction.handle(request).map(response -> new HandlerResult(handlerFunction, response, HANDLER_FUNCTION_RETURN_TYPE));
}
Aggregations