diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.java index a325d602a2a..9c9b619bc38 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewFilter.java @@ -32,7 +32,7 @@ import org.springframework.orm.hibernate3.SessionHolder; import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.util.Assert; import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.context.request.async.WebAsyncManager; import org.springframework.web.context.request.async.WebAsyncManager.WebAsyncThreadInitializer; import org.springframework.web.context.support.WebApplicationContextUtils; @@ -184,7 +184,7 @@ public class OpenSessionInViewFilter extends OncePerRequestFilter { SessionFactory sessionFactory = lookupSessionFactory(request); boolean participate = false; - WebAsyncManager asyncManager = AsyncWebUtils.getAsyncManager(request); + WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request); boolean isFirstRequest = !isAsyncDispatch(request); String key = getAlreadyFilteredAttributeName(); diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewInterceptor.java b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewInterceptor.java index abf3f865f7f..76f40b29142 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewInterceptor.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate3/support/OpenSessionInViewInterceptor.java @@ -26,7 +26,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager import org.springframework.ui.ModelMap; import org.springframework.web.context.request.AsyncWebRequestInterceptor; import org.springframework.web.context.request.WebRequest; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.context.request.async.WebAsyncManager; import org.springframework.web.context.request.async.WebAsyncManager.WebAsyncThreadInitializer; @@ -143,7 +143,7 @@ public class OpenSessionInViewInterceptor extends HibernateAccessor implements A */ public void preHandle(WebRequest request) throws DataAccessException { - WebAsyncManager asyncManager = AsyncWebUtils.getAsyncManager(request); + WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request); String participateAttributeName = getParticipateAttributeName(); if (asyncManager.hasConcurrentResult()) { diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.java b/spring-orm/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.java index d5d21f05a54..a75aba87336 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewFilter.java @@ -32,7 +32,7 @@ import org.springframework.orm.hibernate4.SessionFactoryUtils; import org.springframework.orm.hibernate4.SessionHolder; import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.context.request.async.WebAsyncManager; import org.springframework.web.context.request.async.WebAsyncManager.WebAsyncThreadInitializer; import org.springframework.web.context.support.WebApplicationContextUtils; @@ -117,7 +117,7 @@ public class OpenSessionInViewFilter extends OncePerRequestFilter { SessionFactory sessionFactory = lookupSessionFactory(request); boolean participate = false; - WebAsyncManager asyncManager = AsyncWebUtils.getAsyncManager(request); + WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request); boolean isFirstRequest = !isAsyncDispatch(request); String key = getAlreadyFilteredAttributeName(); diff --git a/spring-orm/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewInterceptor.java b/spring-orm/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewInterceptor.java index 57f4d27787a..05ae7f5fa20 100644 --- a/spring-orm/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewInterceptor.java +++ b/spring-orm/src/main/java/org/springframework/orm/hibernate4/support/OpenSessionInViewInterceptor.java @@ -30,7 +30,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager import org.springframework.ui.ModelMap; import org.springframework.web.context.request.AsyncWebRequestInterceptor; import org.springframework.web.context.request.WebRequest; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.context.request.async.WebAsyncManager; import org.springframework.web.context.request.async.WebAsyncManager.WebAsyncThreadInitializer; @@ -107,7 +107,7 @@ public class OpenSessionInViewInterceptor implements AsyncWebRequestInterceptor String participateAttributeName = getParticipateAttributeName(); - WebAsyncManager asyncManager = AsyncWebUtils.getAsyncManager(request); + WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request); if (asyncManager.hasConcurrentResult()) { if (asyncManager.initializeAsyncThread(participateAttributeName)) { return; diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewFilter.java b/spring-orm/src/main/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewFilter.java index d2117f5ab4f..7c9061cbeae 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewFilter.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewFilter.java @@ -32,7 +32,7 @@ import org.springframework.orm.jpa.EntityManagerHolder; import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.util.StringUtils; import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.context.request.async.WebAsyncManager; import org.springframework.web.context.request.async.WebAsyncManager.WebAsyncThreadInitializer; import org.springframework.web.context.support.WebApplicationContextUtils; @@ -141,7 +141,7 @@ public class OpenEntityManagerInViewFilter extends OncePerRequestFilter { EntityManagerFactory emf = lookupEntityManagerFactory(request); boolean participate = false; - WebAsyncManager asyncManager = AsyncWebUtils.getAsyncManager(request); + WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request); boolean isFirstRequest = !isAsyncDispatch(request); String key = getAlreadyFilteredAttributeName(); diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.java b/spring-orm/src/main/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.java index 365d7bab2f6..fc9e39c54df 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewInterceptor.java @@ -28,7 +28,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager import org.springframework.ui.ModelMap; import org.springframework.web.context.request.AsyncWebRequestInterceptor; import org.springframework.web.context.request.WebRequest; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.context.request.async.WebAsyncManager; import org.springframework.web.context.request.async.WebAsyncManager.WebAsyncThreadInitializer; @@ -74,7 +74,7 @@ public class OpenEntityManagerInViewInterceptor extends EntityManagerFactoryAcce String participateAttributeName = getParticipateAttributeName(); - WebAsyncManager asyncManager = AsyncWebUtils.getAsyncManager(request); + WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request); if (asyncManager.hasConcurrentResult()) { if (asyncManager.initializeAsyncThread(participateAttributeName)) { return; diff --git a/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/OpenSessionInViewTests.java b/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/OpenSessionInViewTests.java index 2ba61a044e5..24566685cab 100644 --- a/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/OpenSessionInViewTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/hibernate3/support/OpenSessionInViewTests.java @@ -63,7 +63,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.request.ServletWebRequest; import org.springframework.web.context.request.async.AsyncWebRequest; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.context.request.async.WebAsyncManager; import org.springframework.web.context.support.StaticWebApplicationContext; @@ -180,7 +180,7 @@ public class OpenSessionInViewTests { asyncWebRequest.startAsync(); replay(asyncWebRequest); - WebAsyncManager asyncManager = AsyncWebUtils.getAsyncManager(this.request); + WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(this.request); asyncManager.setAsyncWebRequest(asyncWebRequest); asyncManager.startCallableProcessing(new Callable() { @@ -499,7 +499,7 @@ public class OpenSessionInViewTests { expect(asyncWebRequest.isDispatched()).andReturn(false).anyTimes(); replay(asyncWebRequest); - WebAsyncManager asyncManager = AsyncWebUtils.getAsyncManager(this.request); + WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(this.request); asyncManager.setAsyncWebRequest(asyncWebRequest); asyncManager.startCallableProcessing(new Callable() { public String call() throws Exception { diff --git a/spring-orm/src/test/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewTests.java b/spring-orm/src/test/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewTests.java index cd731c3b324..ac211a13c57 100644 --- a/spring-orm/src/test/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewTests.java +++ b/spring-orm/src/test/java/org/springframework/orm/jpa/support/OpenEntityManagerInViewTests.java @@ -48,7 +48,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.request.ServletWebRequest; import org.springframework.web.context.request.async.AsyncWebRequest; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.context.request.async.WebAsyncManager; import org.springframework.web.context.support.StaticWebApplicationContext; @@ -157,7 +157,7 @@ public class OpenEntityManagerInViewTests extends TestCase { asyncWebRequest.startAsync(); replay(asyncWebRequest); - WebAsyncManager asyncManager = AsyncWebUtils.getAsyncManager(webRequest); + WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(webRequest); asyncManager.setAsyncWebRequest(asyncWebRequest); asyncManager.startCallableProcessing(new Callable() { public String call() throws Exception { @@ -351,7 +351,7 @@ public class OpenEntityManagerInViewTests extends TestCase { expect(asyncWebRequest.isDispatched()).andReturn(false).anyTimes(); replay(asyncWebRequest); - WebAsyncManager asyncManager = AsyncWebUtils.getAsyncManager(request); + WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request); asyncManager.setAsyncWebRequest(asyncWebRequest); asyncManager.startCallableProcessing(new Callable() { public String call() throws Exception { diff --git a/spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncManager.java b/spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncManager.java index afb30989e2b..5349e0bc88b 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncManager.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncManager.java @@ -80,8 +80,8 @@ public final class WebAsyncManager { /** * Package private constructor. - * @see AsyncWebUtils#getAsyncManager(javax.servlet.ServletRequest) - * @see AsyncWebUtils#getAsyncManager(org.springframework.web.context.request.WebRequest) + * @see WebAsyncUtils#getAsyncManager(javax.servlet.ServletRequest) + * @see WebAsyncUtils#getAsyncManager(org.springframework.web.context.request.WebRequest) */ WebAsyncManager() { } @@ -100,7 +100,7 @@ public final class WebAsyncManager { this.asyncWebRequest = asyncWebRequest; this.asyncWebRequest.addCompletionHandler(new Runnable() { public void run() { - asyncWebRequest.removeAttribute(AsyncWebUtils.WEB_ASYNC_MANAGER_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST); + asyncWebRequest.removeAttribute(WebAsyncUtils.WEB_ASYNC_MANAGER_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST); } }); } diff --git a/spring-web/src/main/java/org/springframework/web/context/request/async/AsyncWebUtils.java b/spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncUtils.java similarity index 97% rename from spring-web/src/main/java/org/springframework/web/context/request/async/AsyncWebUtils.java rename to spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncUtils.java index be8e8ee4288..2465040e451 100644 --- a/spring-web/src/main/java/org/springframework/web/context/request/async/AsyncWebUtils.java +++ b/spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncUtils.java @@ -32,7 +32,7 @@ import org.springframework.web.context.request.WebRequest; * @author Rossen Stoyanchev * @since 3.2 */ -public abstract class AsyncWebUtils { +public abstract class WebAsyncUtils { public static final String WEB_ASYNC_MANAGER_ATTRIBUTE = WebAsyncManager.class.getName() + ".WEB_ASYNC_MANAGER"; @@ -80,7 +80,7 @@ public abstract class AsyncWebUtils { private static AsyncWebRequest createStandardServletAsyncWebRequest(HttpServletRequest request, HttpServletResponse response) { try { String className = "org.springframework.web.context.request.async.StandardServletAsyncWebRequest"; - Class clazz = ClassUtils.forName(className, AsyncWebUtils.class.getClassLoader()); + Class clazz = ClassUtils.forName(className, WebAsyncUtils.class.getClassLoader()); Constructor constructor = clazz.getConstructor(HttpServletRequest.class, HttpServletResponse.class); return (AsyncWebRequest) BeanUtils.instantiateClass(constructor, request, response); } diff --git a/spring-web/src/main/java/org/springframework/web/filter/OncePerRequestFilter.java b/spring-web/src/main/java/org/springframework/web/filter/OncePerRequestFilter.java index 6b2f6c84c25..78f49debb89 100644 --- a/spring-web/src/main/java/org/springframework/web/filter/OncePerRequestFilter.java +++ b/spring-web/src/main/java/org/springframework/web/filter/OncePerRequestFilter.java @@ -25,7 +25,7 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; /** * Filter base class that guarantees to be just executed once per request, @@ -159,7 +159,7 @@ public abstract class OncePerRequestFilter extends GenericFilterBean { * @see org.springframework.web.context.request.async.WebAsyncManager */ protected final boolean isAsyncDispatch(HttpServletRequest request) { - return AsyncWebUtils.getAsyncManager(request).hasConcurrentResult(); + return WebAsyncUtils.getAsyncManager(request).hasConcurrentResult(); } /** @@ -175,7 +175,7 @@ public abstract class OncePerRequestFilter extends GenericFilterBean { * @see org.springframework.web.context.request.async.WebAsyncManager */ protected final boolean isLastRequestThread(HttpServletRequest request) { - return (!AsyncWebUtils.getAsyncManager(request).isConcurrentHandlingStarted()); + return (!WebAsyncUtils.getAsyncManager(request).isConcurrentHandlingStarted()); } /** diff --git a/spring-web/src/test/java/org/springframework/web/context/request/async/WebAsyncManagerTests.java b/spring-web/src/test/java/org/springframework/web/context/request/async/WebAsyncManagerTests.java index 019385fd876..f324273eb2f 100644 --- a/spring-web/src/test/java/org/springframework/web/context/request/async/WebAsyncManagerTests.java +++ b/spring-web/src/test/java/org/springframework/web/context/request/async/WebAsyncManagerTests.java @@ -51,7 +51,7 @@ public class WebAsyncManagerTests { @Before public void setUp() { - this.asyncManager = AsyncWebUtils.getAsyncManager(new MockHttpServletRequest()); + this.asyncManager = WebAsyncUtils.getAsyncManager(new MockHttpServletRequest()); this.asyncManager.setTaskExecutor(new SyncTaskExecutor()); this.asyncWebRequest = createStrictMock(AsyncWebRequest.class); @@ -142,7 +142,7 @@ public class WebAsyncManagerTests { @Test public void startCallableProcessingNullRequest() { - WebAsyncManager manager = AsyncWebUtils.getAsyncManager(new MockHttpServletRequest()); + WebAsyncManager manager = WebAsyncUtils.getAsyncManager(new MockHttpServletRequest()); try { manager.startCallableProcessing(new Callable() { public Object call() throws Exception { diff --git a/spring-web/src/test/java/org/springframework/web/filter/CharacterEncodingFilterTests.java b/spring-web/src/test/java/org/springframework/web/filter/CharacterEncodingFilterTests.java index 415d0c3b307..a5fa128dd39 100644 --- a/spring-web/src/test/java/org/springframework/web/filter/CharacterEncodingFilterTests.java +++ b/spring-web/src/test/java/org/springframework/web/filter/CharacterEncodingFilterTests.java @@ -33,7 +33,7 @@ import junit.framework.TestCase; import org.springframework.mock.web.MockFilterConfig; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.mock.web.MockServletContext; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; /** * @author Rick Evans @@ -176,9 +176,9 @@ public class CharacterEncodingFilterTests extends TestCase { private void addAsyncManagerExpectations(HttpServletRequest request) { - expect(request.getAttribute(AsyncWebUtils.WEB_ASYNC_MANAGER_ATTRIBUTE)).andReturn(null); + expect(request.getAttribute(WebAsyncUtils.WEB_ASYNC_MANAGER_ATTRIBUTE)).andReturn(null); expectLastCall().anyTimes(); - request.setAttribute(same(AsyncWebUtils.WEB_ASYNC_MANAGER_ATTRIBUTE), notNull()); + request.setAttribute(same(WebAsyncUtils.WEB_ASYNC_MANAGER_ATTRIBUTE), notNull()); expectLastCall().anyTimes(); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/AsyncHandlerInterceptor.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/AsyncHandlerInterceptor.java index 38d2c521df0..372a8e5f455 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/AsyncHandlerInterceptor.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/AsyncHandlerInterceptor.java @@ -52,7 +52,8 @@ public interface AsyncHandlerInterceptor extends HandlerInterceptor { * * @param request the current request * @param response the current response + * @param handler handler that started async execution, for type and/or instance examination */ - void afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response); + void afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response, Object handler); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java index 51c9828054f..f090bfd3651 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java @@ -51,7 +51,7 @@ import org.springframework.util.StringUtils; import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.request.ServletWebRequest; import org.springframework.web.context.request.async.WebAsyncManager; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.multipart.MultipartException; import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartResolver; @@ -819,7 +819,7 @@ public class DispatcherServlet extends FrameworkServlet { if (logger.isDebugEnabled()) { String requestUri = urlPathHelper.getRequestUri(request); - String resumed = AsyncWebUtils.getAsyncManager(request).hasConcurrentResult() ? " resumed" : ""; + String resumed = WebAsyncUtils.getAsyncManager(request).hasConcurrentResult() ? " resumed" : ""; logger.debug("DispatcherServlet with name '" + getServletName() + "'" + resumed + " processing " + request.getMethod() + " request for [" + requestUri + "]"); } @@ -856,7 +856,7 @@ public class DispatcherServlet extends FrameworkServlet { doDispatch(request, response); } finally { - if (AsyncWebUtils.getAsyncManager(request).isConcurrentHandlingStarted()) { + if (WebAsyncUtils.getAsyncManager(request).isConcurrentHandlingStarted()) { return; } // Restore the original attribute snapshot, in case of an include. @@ -882,7 +882,7 @@ public class DispatcherServlet extends FrameworkServlet { HandlerExecutionChain mappedHandler = null; boolean multipartRequestParsed = false; - WebAsyncManager asyncManager = AsyncWebUtils.getAsyncManager(request); + WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request); try { ModelAndView mv = null; @@ -1001,7 +1001,7 @@ public class DispatcherServlet extends FrameworkServlet { } } - if (AsyncWebUtils.getAsyncManager(request).isConcurrentHandlingStarted()) { + if (WebAsyncUtils.getAsyncManager(request).isConcurrentHandlingStarted()) { // Concurrent handling started during a forward return; } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java index f4616752a95..762a238ff22 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java @@ -47,7 +47,7 @@ import org.springframework.web.context.WebApplicationContext; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.context.request.async.WebAsyncManager; import org.springframework.web.context.request.async.WebAsyncManager.WebAsyncThreadInitializer; import org.springframework.web.context.support.ServletRequestHandledEvent; @@ -908,7 +908,7 @@ public abstract class FrameworkServlet extends HttpServletBean { initContextHolders(request, localeContext, requestAttributes); - WebAsyncManager asyncManager = AsyncWebUtils.getAsyncManager(request); + WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request); asyncManager.registerAsyncThreadInitializer(this.getClass().getName(), createAsyncThreadInitializer(request)); try { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerExecutionChain.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerExecutionChain.java index 1e7323a2771..b1b3134beff 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerExecutionChain.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerExecutionChain.java @@ -182,8 +182,8 @@ public class HandlerExecutionChain { for (int i = getInterceptors().length - 1; i >= 0; i--) { if (interceptors[i] instanceof AsyncHandlerInterceptor) { try { - AsyncHandlerInterceptor asyncInterceptor = (AsyncHandlerInterceptor) interceptors[i]; - asyncInterceptor.afterConcurrentHandlingStarted(request, response); + AsyncHandlerInterceptor asyncInterceptor = (AsyncHandlerInterceptor) this.interceptors[i]; + asyncInterceptor.afterConcurrentHandlingStarted(request, response, this.handler); } catch (Throwable ex) { logger.error("Interceptor [" + interceptors[i] + "] failed in afterConcurrentHandlingStarted", ex); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/WebRequestHandlerInterceptorAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/WebRequestHandlerInterceptorAdapter.java index 29ef20bde68..8e70a48fa45 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/WebRequestHandlerInterceptorAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/handler/WebRequestHandlerInterceptorAdapter.java @@ -69,7 +69,7 @@ public class WebRequestHandlerInterceptorAdapter implements AsyncHandlerIntercep this.requestInterceptor.afterCompletion(new DispatcherServletWebRequest(request, response), ex); } - public void afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response) { + public void afterConcurrentHandlingStarted(HttpServletRequest request, HttpServletResponse response, Object handler) { if (this.requestInterceptor instanceof AsyncWebRequestInterceptor) { AsyncWebRequestInterceptor asyncInterceptor = (AsyncWebRequestInterceptor) this.requestInterceptor; DispatcherServletWebRequest webRequest = new DispatcherServletWebRequest(request, response); diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AsyncTaskMethodReturnValueHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AsyncTaskMethodReturnValueHandler.java index 3892fccd926..3fda5349b87 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AsyncTaskMethodReturnValueHandler.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/AsyncTaskMethodReturnValueHandler.java @@ -20,7 +20,7 @@ import org.springframework.beans.factory.BeanFactory; import org.springframework.core.MethodParameter; import org.springframework.web.context.request.NativeWebRequest; import org.springframework.web.context.request.async.AsyncTask; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.method.support.HandlerMethodReturnValueHandler; import org.springframework.web.method.support.ModelAndViewContainer; @@ -54,7 +54,7 @@ public class AsyncTaskMethodReturnValueHandler implements HandlerMethodReturnVal AsyncTask asyncTask = (AsyncTask) returnValue; asyncTask.setBeanFactory(this.beanFactory); - AsyncWebUtils.getAsyncManager(webRequest).startCallableProcessing(asyncTask.getCallable(), mavContainer); + WebAsyncUtils.getAsyncManager(webRequest).startCallableProcessing(asyncTask.getCallable(), mavContainer); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/CallableMethodReturnValueHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/CallableMethodReturnValueHandler.java index ab53315b64f..5b6f04d36ac 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/CallableMethodReturnValueHandler.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/CallableMethodReturnValueHandler.java @@ -20,7 +20,7 @@ import java.util.concurrent.Callable; import org.springframework.core.MethodParameter; import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.method.support.HandlerMethodReturnValueHandler; import org.springframework.web.method.support.ModelAndViewContainer; @@ -46,7 +46,7 @@ public class CallableMethodReturnValueHandler implements HandlerMethodReturnValu } Callable callable = (Callable) returnValue; - AsyncWebUtils.getAsyncManager(webRequest).startCallableProcessing(callable, mavContainer); + WebAsyncUtils.getAsyncManager(webRequest).startCallableProcessing(callable, mavContainer); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultMethodReturnValueHandler.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultMethodReturnValueHandler.java index 8e20f4de220..bda8ac8eb09 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultMethodReturnValueHandler.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/DeferredResultMethodReturnValueHandler.java @@ -18,7 +18,7 @@ package org.springframework.web.servlet.mvc.method.annotation; import org.springframework.core.MethodParameter; import org.springframework.web.context.request.NativeWebRequest; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.context.request.async.DeferredResult; import org.springframework.web.method.support.HandlerMethodReturnValueHandler; import org.springframework.web.method.support.ModelAndViewContainer; @@ -45,7 +45,7 @@ public class DeferredResultMethodReturnValueHandler implements HandlerMethodRetu } DeferredResult deferredResult = (DeferredResult) returnValue; - AsyncWebUtils.getAsyncManager(webRequest).startDeferredResultProcessing(deferredResult, mavContainer); + WebAsyncUtils.getAsyncManager(webRequest).startDeferredResultProcessing(deferredResult, mavContainer); } } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java index 4a6f743aa60..da50107b0b3 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerAdapter.java @@ -64,7 +64,7 @@ import org.springframework.web.context.request.ServletWebRequest; import org.springframework.web.context.request.WebRequest; import org.springframework.web.context.request.async.AsyncTask; import org.springframework.web.context.request.async.AsyncWebRequest; -import org.springframework.web.context.request.async.AsyncWebUtils; +import org.springframework.web.context.request.async.WebAsyncUtils; import org.springframework.web.context.request.async.WebAsyncManager; import org.springframework.web.method.ControllerAdviceBean; import org.springframework.web.method.HandlerMethod; @@ -696,10 +696,10 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter i modelFactory.initModel(webRequest, mavContainer, requestMappingMethod); mavContainer.setIgnoreDefaultModelOnRedirect(this.ignoreDefaultModelOnRedirect); - AsyncWebRequest asyncWebRequest = AsyncWebUtils.createAsyncWebRequest(request, response); + AsyncWebRequest asyncWebRequest = WebAsyncUtils.createAsyncWebRequest(request, response); asyncWebRequest.setTimeout(this.asyncRequestTimeout); - final WebAsyncManager asyncManager = AsyncWebUtils.getAsyncManager(request); + final WebAsyncManager asyncManager = WebAsyncUtils.getAsyncManager(request); asyncManager.setTaskExecutor(this.taskExecutor); asyncManager.setAsyncWebRequest(asyncWebRequest); diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/HandlerExecutionChainTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/HandlerExecutionChainTests.java index d537ec71587..dc48aa5fc5a 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/HandlerExecutionChainTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/HandlerExecutionChainTests.java @@ -92,15 +92,13 @@ public class HandlerExecutionChainTests { @Test public void successAsyncScenario() throws Exception { - ModelAndView mav = new ModelAndView(); - expect(this.interceptor1.preHandle(this.request, this.response, this.handler)).andReturn(true); expect(this.interceptor2.preHandle(this.request, this.response, this.handler)).andReturn(true); expect(this.interceptor3.preHandle(this.request, this.response, this.handler)).andReturn(true); - this.interceptor1.afterConcurrentHandlingStarted(request, response); - this.interceptor2.afterConcurrentHandlingStarted(request, response); - this.interceptor3.afterConcurrentHandlingStarted(request, response); + this.interceptor1.afterConcurrentHandlingStarted(request, response, this.handler); + this.interceptor2.afterConcurrentHandlingStarted(request, response, this.handler); + this.interceptor3.afterConcurrentHandlingStarted(request, response, this.handler); replay(this.interceptor1, this.interceptor2, this.interceptor3);