Refine onError handling WebAsyncManager
In addition to the wrapping of errors recognized as client disconnected errors with AsyncRequestNotUsableException, we now wrap any IOException in the onError callback. The Servlet container would only be aware of such an exception if it relates to the response. Closes gh-33832
This commit is contained in:
parent
21604d1a25
commit
d9100917d1
|
@ -16,6 +16,7 @@
|
|||
|
||||
package org.springframework.web.context.request.async;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
|
@ -34,7 +35,6 @@ import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
|||
import org.springframework.util.Assert;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.async.DeferredResult.DeferredResultHandler;
|
||||
import org.springframework.web.util.DisconnectedClientHelper;
|
||||
|
||||
/**
|
||||
* The central class for managing asynchronous request processing, mainly intended
|
||||
|
@ -343,7 +343,7 @@ public final class WebAsyncManager {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Servlet container error notification for " + formatUri(this.asyncWebRequest) + ": " + ex);
|
||||
}
|
||||
if (DisconnectedClientHelper.isClientDisconnectedException(ex)) {
|
||||
if (ex instanceof IOException) {
|
||||
ex = new AsyncRequestNotUsableException(
|
||||
"Servlet container error notification for disconnected client", ex);
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ public final class WebAsyncManager {
|
|||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Servlet container error notification for " + formatUri(this.asyncWebRequest));
|
||||
}
|
||||
if (DisconnectedClientHelper.isClientDisconnectedException(ex)) {
|
||||
if (ex instanceof IOException) {
|
||||
ex = new AsyncRequestNotUsableException(
|
||||
"Servlet container error notification for disconnected client", ex);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue