diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteFlushProcessor.java b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteFlushProcessor.java index 81c8098d32..3a323c86bc 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteFlushProcessor.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/AbstractListenerWriteFlushProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -186,12 +186,13 @@ public abstract class AbstractListenerWriteFlushProcessor implements Processo protected abstract boolean isFlushPending(); /** - * Invoked when an error happens while flushing. Sub-classes may choose - * to ignore this if they know the underlying API will provide an error - * notification in a container thread. - *

Defaults to no-op. + * Invoked when an error happens while flushing. + *

The default implementation cancels the upstream write publisher and + * sends an onError downstream as the result of request handling. */ protected void flushingFailed(Throwable t) { + cancel(); + onError(t); } diff --git a/spring-web/src/main/java/org/springframework/http/server/reactive/UndertowServerHttpResponse.java b/spring-web/src/main/java/org/springframework/http/server/reactive/UndertowServerHttpResponse.java index 3e1d5c35c2..5f8034b724 100644 --- a/spring-web/src/main/java/org/springframework/http/server/reactive/UndertowServerHttpResponse.java +++ b/spring-web/src/main/java/org/springframework/http/server/reactive/UndertowServerHttpResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2020 the original author or authors. + * Copyright 2002-2021 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -283,12 +283,6 @@ class UndertowServerHttpResponse extends AbstractListenerServerHttpResponse impl } } - @Override - protected void flushingFailed(Throwable t) { - cancel(); - onError(t); - } - @Override protected boolean isWritePossible() { StreamSinkChannel channel = UndertowServerHttpResponse.this.responseChannel;