Update to latest Reactor 3.1 API changes
Issue: SPR-15318
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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)) :
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user