CorsInterceptor skips async dispatch
Closes gh-24223
This commit is contained in:
@@ -36,6 +36,8 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.util.PathMatcher;
|
||||
import org.springframework.web.HttpRequestHandler;
|
||||
import org.springframework.web.context.request.WebRequestInterceptor;
|
||||
import org.springframework.web.context.request.async.WebAsyncManager;
|
||||
import org.springframework.web.context.request.async.WebAsyncUtils;
|
||||
import org.springframework.web.context.support.WebApplicationObjectSupport;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.CorsConfigurationSource;
|
||||
@@ -569,6 +571,12 @@ public abstract class AbstractHandlerMapping extends WebApplicationObjectSupport
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
|
||||
throws Exception {
|
||||
|
||||
// Consistent with CorsFilter, ignore ASYNC dispatches
|
||||
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
|
||||
if (asyncManager.hasConcurrentResult()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return corsProcessor.processRequest(this.config, request, response);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user