Rename Mono#otherwise[Empty] to switch[onError/IfEmpty]
Issue: SPR-15318
This commit is contained in:
@@ -57,7 +57,7 @@ public class ReactorHttpHandlerAdapter
|
||||
ReactorServerHttpResponse resp = new ReactorServerHttpResponse(response, bufferFactory);
|
||||
|
||||
return this.httpHandler.handle(req, resp)
|
||||
.otherwise(ex -> {
|
||||
.switchOnError(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)
|
||||
.otherwise(ex -> {
|
||||
.switchOnError(ex -> {
|
||||
logger.error("Could not complete request", ex);
|
||||
nativeResponse.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
|
||||
return Mono.empty();
|
||||
|
||||
@@ -106,7 +106,7 @@ public class DefaultServerWebExchange implements ServerWebExchange {
|
||||
if (MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(contentType)) {
|
||||
return FORM_READER
|
||||
.readMono(FORM_DATA_VALUE_TYPE, request, Collections.emptyMap())
|
||||
.otherwiseIfEmpty(EMPTY_FORM_DATA)
|
||||
.switchIfEmpty(EMPTY_FORM_DATA)
|
||||
.cache();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
.otherwise(ex -> {
|
||||
.switchOnError(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.otherwise(ex -> handler.handle(exchange, ex));
|
||||
completion = completion.switchOnError(ex -> handler.handle(exchange, ex));
|
||||
}
|
||||
|
||||
return completion;
|
||||
|
||||
@@ -105,7 +105,7 @@ public class DefaultWebSessionManager implements WebSessionManager {
|
||||
.concatMap(this.sessionStore::retrieveSession)
|
||||
.next()
|
||||
.flatMap(session -> validateSession(exchange, session))
|
||||
.otherwiseIfEmpty(createSession(exchange))
|
||||
.switchIfEmpty(createSession(exchange))
|
||||
.map(session -> extendSession(exchange, session)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user