Affects: \ 5.3.8
org.springframework.web.reactive.function.server.support.ServerResponseResultHandler.java
can NOT handle Mono<ServerResponse> or Flux<ServerResponse>
.
public boolean supports(HandlerResult result)
always return false.
because it check a returnValue type of HandlerResult .
need to replace a return type with a generic type of it.
see below error code.
@Override
public boolean supports(HandlerResult result) {
return (result.getReturnValue() instanceof ServerResponse);
}
fix like below it has to compare with a generic type of returnType
@Override
public boolean supports(HandlerResult result) {
return ServerResponse.class.isAssignableFrom(result.getReturnType().getGeneric().toClass());
}
Comment From: hongjunan
i make a PR
https://github.com/spring-projects/spring-framework/pull/27268
Comment From: poutsma
I don't really understand what you mean by handling Flux<ServerResponse>
. Such a stream could contain multiple responses, with multiple response codes, headers, and bodies. We can only use one; what do we do with the rest?
And I am not so sure why supporting Mono<ServerResponse>
is necessary. In other words: what is the use case here?
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: hongjunan
Currently, reactive handler cannot handle webflux streaming. Because handler are not checking whether the response value is reactive. Please take a look at the source code I suggested above. The current program is not working properly because of wrong condition checking.
Comment From: snicoll
@hongjunan I am also confused as what you're trying to do and, with a lack of concrete use case, we can't justify spending more time on this issue. If you can provide that information, we can obviously reconsider.