Update to latest Reactor 3.1 API changes

Issue: SPR-15318
This commit is contained in:
Sebastien Deleuze
2017-04-14 13:18:20 +02:00
parent 135651de9a
commit 005e85b0f5
12 changed files with 15 additions and 15 deletions

View File

@@ -90,7 +90,7 @@ public class DecoderHttpMessageReader<T> implements HttpMessageReader<T> {
MediaType contentType = getContentType(message);
return this.decoder
.decode(message.getBody(), elementType, contentType, hints)
.mapError(this::mapError);
.onErrorMap(this::mapError);
}
@Override
@@ -100,7 +100,7 @@ public class DecoderHttpMessageReader<T> implements HttpMessageReader<T> {
MediaType contentType = getContentType(message);
return this.decoder
.decodeToMono(message.getBody(), elementType, contentType, hints)
.mapError(this::mapError);
.onErrorMap(this::mapError);
}
private MediaType getContentType(HttpMessage inputMessage) {

View File

@@ -99,7 +99,7 @@ public class EncoderHttpMessageWriter<T> implements HttpMessageWriter<T> {
Flux<DataBuffer> body = this.encoder
.encode(inputStream, message.bufferFactory(), elementType, contentType, hints)
.mapError(this::mapError);
.onErrorMap(this::mapError);
return isStreamingMediaType(contentType) ?
message.writeAndFlushWith(body.map(Flux::just)) :

View File

@@ -57,7 +57,7 @@ public class ReactorHttpHandlerAdapter
ReactorServerHttpResponse resp = new ReactorServerHttpResponse(response, bufferFactory);
return this.httpHandler.handle(req, resp)
.switchOnError(ex -> {
.onErrorResume(ex -> {
logger.error("Could not complete request", ex);
response.status(HttpResponseStatus.INTERNAL_SERVER_ERROR);
return Mono.empty();

View File

@@ -66,7 +66,7 @@ public class RxNettyHttpHandlerAdapter implements RequestHandler<ByteBuf, ByteBu
RxNettyServerHttpResponse response = new RxNettyServerHttpResponse(nativeResponse, bufferFactory);
Publisher<Void> result = this.httpHandler.handle(request, response)
.switchOnError(ex -> {
.onErrorResume(ex -> {
logger.error("Could not complete request", ex);
nativeResponse.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
return Mono.empty();

View File

@@ -76,7 +76,7 @@ public class HttpWebHandlerAdapter extends WebHandlerDecorator implements HttpHa
public Mono<Void> handle(ServerHttpRequest request, ServerHttpResponse response) {
ServerWebExchange exchange = createExchange(request, response);
return getDelegate().handle(exchange)
.switchOnError(ex -> {
.onErrorResume(ex -> {
if (logger.isDebugEnabled()) {
logger.debug("Could not complete request", ex);
}

View File

@@ -99,7 +99,7 @@ public class ExceptionHandlingWebHandler extends WebHandlerDecorator {
}
for (WebExceptionHandler handler : this.exceptionHandlers) {
completion = completion.switchOnError(ex -> handler.handle(exchange, ex));
completion = completion.onErrorResume(ex -> handler.handle(exchange, ex));
}
return completion;