Search in sources :

Example 1 with ServerRequest

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));
}
Also used : HandlerFunction(org.springframework.web.reactive.function.server.HandlerFunction) HandlerResult(org.springframework.web.reactive.HandlerResult) ServerRequest(org.springframework.web.reactive.function.server.ServerRequest)

Aggregations

HandlerResult (org.springframework.web.reactive.HandlerResult)1 HandlerFunction (org.springframework.web.reactive.function.server.HandlerFunction)1 ServerRequest (org.springframework.web.reactive.function.server.ServerRequest)1