Handle flushingFailed() for Servlet containers

Closes gh-26434
This commit is contained in:
Rossen Stoyanchev 2021-01-28 17:03:08 +00:00
parent d7e05aa48f
commit 5e5d8e4a23
2 changed files with 7 additions and 12 deletions

View File

@ -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<T> 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.
* <p>Defaults to no-op.
* Invoked when an error happens while flushing.
* <p>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);
}

View File

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