Rename Mono#otherwise[Empty] to switch[onError/IfEmpty]

Issue: SPR-15318
This commit is contained in:
Sebastien Deleuze
2017-04-13 15:30:21 +02:00
parent cec36fe784
commit e3fae2716e
19 changed files with 23 additions and 23 deletions

View File

@@ -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();

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)
.otherwise(ex -> {
.switchOnError(ex -> {
logger.error("Could not complete request", ex);
nativeResponse.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR);
return Mono.empty();

View File

@@ -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();
}
}

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)
.otherwise(ex -> {
.switchOnError(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.otherwise(ex -> handler.handle(exchange, ex));
completion = completion.switchOnError(ex -> handler.handle(exchange, ex));
}
return completion;

View File

@@ -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)));
}