Use DataBufferUtils.compose and remove writeAggregator

Use DataBufferUtils.compose instead of writeAggregator to combine
multiple data buffers into one, as the write aggregator would not work
when the initial data buffer did not have enough capacity to contain
all subsequent buffers.

Removed writeAggregator, as it is no longer needed.

Issue: SPR-16365
This commit is contained in:
Arjen Poutsma
2018-01-12 10:35:34 +01:00
parent 384a399fd2
commit 67e7c784e8
12 changed files with 20 additions and 50 deletions

View File

@@ -96,7 +96,7 @@ public class FormHttpMessageReader implements HttpMessageReader<MultiValueMap<St
MediaType contentType = message.getHeaders().getContentType();
Charset charset = getMediaTypeCharset(contentType);
return message.getBody().reduce(DataBufferUtils.writeAggregator())
return DataBufferUtils.compose(message.getBody())
.map(buffer -> {
CharBuffer charBuffer = charset.decode(buffer.asByteBuffer());
String body = charBuffer.toString();

View File

@@ -103,7 +103,7 @@ public class XmlEventDecoder extends AbstractDecoder<XMLEvent> {
.doFinally(signalType -> aaltoMapper.endOfInput());
}
else {
Mono<DataBuffer> singleBuffer = flux.reduce(DataBufferUtils.writeAggregator());
Mono<DataBuffer> singleBuffer = DataBufferUtils.compose(flux);
return singleBuffer.
flatMapMany(dataBuffer -> {
try {