This commit is contained in:
Rossen Stoyanchev 2017-06-01 09:28:55 -04:00
parent e8d2c6c74b
commit b93579a43e
3 changed files with 14 additions and 12 deletions

View File

@ -163,11 +163,11 @@ public abstract class AbstractListenerWriteProcessor<T> implements Processor<T,
} }
/** /**
* Invoked when an error happens while writing. Defaults to no-op. * Invoked when an error happens while writing.
* Servlet 3.1 based implementations will receive * <p>Defaults to no-op. Servlet 3.1 based implementations will receive
* {@link WriteListener#onError(Throwable)} event. * {@code javax.servlet.WriteListener#onError(Throwable)} event.
*/ */
protected void writingFailed(Throwable t) { protected void writingFailed(Throwable ex) {
} }

View File

@ -192,9 +192,10 @@ public class ServletServerHttpResponse extends AbstractListenerServerHttpRespons
} }
void handleError(Throwable ex) { void handleError(Throwable ex) {
if (bodyFlushProcessor != null) { ResponseBodyFlushProcessor flushProcessor = bodyFlushProcessor;
bodyFlushProcessor.cancel(); if (flushProcessor != null) {
bodyFlushProcessor.onError(ex); flushProcessor.cancel();
flushProcessor.onError(ex);
} }
ResponseBodyProcessor processor = bodyProcessor; ResponseBodyProcessor processor = bodyProcessor;
@ -206,9 +207,10 @@ public class ServletServerHttpResponse extends AbstractListenerServerHttpRespons
@Override @Override
public void onComplete(AsyncEvent event) { public void onComplete(AsyncEvent event) {
if (bodyFlushProcessor != null) { ResponseBodyFlushProcessor flushProcessor = bodyFlushProcessor;
bodyFlushProcessor.cancel(); if (flushProcessor != null) {
bodyFlushProcessor.onComplete(); flushProcessor.cancel();
flushProcessor.onComplete();
} }
ResponseBodyProcessor processor = bodyProcessor; ResponseBodyProcessor processor = bodyProcessor;

View File

@ -231,9 +231,9 @@ public class UndertowServerHttpResponse extends AbstractListenerServerHttpRespon
} }
@Override @Override
protected void writingFailed(Throwable t) { protected void writingFailed(Throwable ex) {
cancel(); cancel();
onError(t); onError(ex);
} }
} }