Closed
Description
Francisco Lozano opened SPR-12608 and commented
HandlerIntercetor#preHandle is invoked twice in an async scenario.
The problem is that it's not documented how to differentiate and avoid double-executing some logic. As it's a very common problem when using interceptors and using async handling, adding some explicit doc about how to handle would help.
if (DispatcherType.ASYNC.equals(request.getDispatcherType())) {
return true;
}
doStuffAsUsual();
return whatever;
Affects: 4.1.4
Reference URL: https://github.com/flozano/spring-interceptor-async-test
Issue Links:
- HTTP Streaming and Server-Sent Events (SSE) [SPR-12212] #16826 HTTP Streaming and Server-Sent Events (SSE)
- Document how HandlerInterceptor can hook into async request timedout [SPR-12720] #17317 Document how HandlerInterceptor can hook into async request timedout
Referenced from: commits 1803978