Make the signature of RHOM#writeAndFlush() more flexible

This modifies the signature of
ReactiveHttpOutputMessage#writeAndFlush(...) in order to
be able to use Flux<Flux<DataBuffer>> objects as arguments of
this method.

Issue: SPR-14952
This commit is contained in:
Daniel Fernández
2016-11-24 22:58:10 +01:00
committed by Sebastien Deleuze
parent a143b57d4b
commit a98be035a3
11 changed files with 21 additions and 21 deletions

View File

@@ -64,7 +64,7 @@ public interface ReactiveHttpOutputMessage extends HttpMessage {
* @param body the body content publisher
* @return a {@link Mono} that indicates completion or error
*/
Mono<Void> writeAndFlushWith(Publisher<Publisher<DataBuffer>> body);
Mono<Void> writeAndFlushWith(Publisher<? extends Publisher<DataBuffer>> body);
/**
* Indicate that message handling is complete, allowing for any cleanup or

View File

@@ -80,7 +80,7 @@ public class ReactorClientHttpRequest extends AbstractClientHttpRequest {
}
@Override
public Mono<Void> writeAndFlushWith(Publisher<Publisher<DataBuffer>> body) {
public Mono<Void> writeAndFlushWith(Publisher<? extends Publisher<DataBuffer>> body) {
Publisher<Publisher<ByteBuf>> byteBufs = Flux.from(body).
map(ReactorClientHttpRequest::toByteBufs);
return applyBeforeCommit().then(this.httpRequest

View File

@@ -48,7 +48,7 @@ public abstract class AbstractListenerServerHttpResponse extends AbstractServerH
}
@Override
protected final Mono<Void> writeAndFlushWithInternal(Publisher<Publisher<DataBuffer>> body) {
protected final Mono<Void> writeAndFlushWithInternal(Publisher<? extends Publisher<DataBuffer>> body) {
if (this.writeCalled.compareAndSet(false, true)) {
Processor<Publisher<DataBuffer>, Void> bodyProcessor = createBodyFlushProcessor();
return Mono.from(subscriber -> {

View File

@@ -131,7 +131,7 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse {
}
@Override
public final Mono<Void> writeAndFlushWith(Publisher<Publisher<DataBuffer>> body) {
public final Mono<Void> writeAndFlushWith(Publisher<? extends Publisher<DataBuffer>> body) {
return new ChannelSendOperator<>(body,
writePublisher -> doCommit(() -> writeAndFlushWithInternal(writePublisher)));
}
@@ -193,7 +193,7 @@ public abstract class AbstractServerHttpResponse implements ServerHttpResponse {
* each {@code Publisher<DataBuffer>}.
* @param body the publisher to write and flush with
*/
protected abstract Mono<Void> writeAndFlushWithInternal(Publisher<Publisher<DataBuffer>> body);
protected abstract Mono<Void> writeAndFlushWithInternal(Publisher<? extends Publisher<DataBuffer>> body);
/**
* Implement this method to write the status code to the underlying response.

View File

@@ -76,7 +76,7 @@ public class ReactorServerHttpResponse extends AbstractServerHttpResponse
}
@Override
protected Mono<Void> writeAndFlushWithInternal(Publisher<Publisher<DataBuffer>> publisher) {
protected Mono<Void> writeAndFlushWithInternal(Publisher<? extends Publisher<DataBuffer>> publisher) {
Publisher<Publisher<ByteBuf>> body = Flux.from(publisher)
.map(ReactorServerHttpResponse::toByteBufs);
return this.response.sendGroups(body);

View File

@@ -80,7 +80,7 @@ public class RxNettyServerHttpResponse extends AbstractServerHttpResponse {
@Override
protected Mono<Void> writeAndFlushWithInternal(
Publisher<Publisher<DataBuffer>> body) {
Publisher<? extends Publisher<DataBuffer>> body) {
Flux<ByteBuf> bodyWithFlushSignals = Flux.from(body).
flatMap(publisher -> Flux.from(publisher).
map(NettyDataBufferFactory::toByteBuf).