use of org.springframework.web.context.request.async.DeferredResultProcessingInterceptorAdapter in project spring-framework by spring-projects.
the class TestDispatcherServlet method registerAsyncResultInterceptors.
private void registerAsyncResultInterceptors(final HttpServletRequest request) {
WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request);
asyncManager.registerCallableInterceptor(KEY, new CallableProcessingInterceptorAdapter() {
@Override
public <T> void postProcess(NativeWebRequest r, Callable<T> task, Object value) throws Exception {
getMvcResult(request).setAsyncResult(value);
}
});
asyncManager.registerDeferredResultInterceptor(KEY, new DeferredResultProcessingInterceptorAdapter() {
@Override
public <T> void postProcess(NativeWebRequest r, DeferredResult<T> result, Object value) throws Exception {
getMvcResult(request).setAsyncResult(value);
}
});
}
Aggregations