diff --git a/src/reference/docbook/mvc.xml b/src/reference/docbook/mvc.xml
index 3225df34656..53150169770 100644
--- a/src/reference/docbook/mvc.xml
+++ b/src/reference/docbook/mvc.xml
@@ -2490,7 +2490,7 @@ deferredResult.setResult(data);
- Async Request Processing and Exception Handling
+ Exception Handling for Async Requests
What happens if a Callable returned
from a controller method raises an Exception while being executed?
@@ -2560,38 +2560,78 @@ deferredResult.setResult(data);
- Async Request Configuration
-
- The MVC Java config and the MVC namespace provide options for
- configuring async request processing.
- WebMvcConfigurer has the method
- configureAsyncSupport while <mvc:annotation-driven>
- has an <async-support> sub-element.
-
- Those allow you to configure the default timeout value to use for
- async requests, which if not set depends on the underlying Servlet
- container (e.g. 10 seconds on Tomcat). You can also configure an
- AsyncTaskExecutor to use for executing
- Callable instances returned from
- controller methods. It is highly recommended to configure this property
- since by default Spring MVC uses
- SimpleAsyncTaskExecutor. The MVC Java config
- and the MVC namespace also allow you to register
- CallableProcessingInterceptor and
- DeferredResultProcessingInterceptor
- instances.
+ Configuration for Async Request Processing
- If you need to override the default timeout value for a
- specific DeferredResult, you can do so by using
- the appropriate class constructor. Similarly, for a
- Callable, you can wrap it in a
- WebAsyncTask and use the appropriate class
- constructor to customize the timeout value. The class constructor of
- WebAsyncTask also allows providing
- an AsyncTaskExecutor.
+
+ Servlet 3 Async Config
-
+ To use Servlet 3 async request processing, you need to update
+ web.xml to version 3.0:
+
+ <web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ version="3.0">
+
+ ...
+
+ <web-app>
+
+
+ The DispatcherServlet and any
+ Filter configuration need to have
+ the <async-supported>true</async-supported> sub-element.
+ Additionally, any Filter that also needs
+ to get involved in async dispatches should also be configured
+ to support the ASYNC dispatcher type. Note that it is safe
+ to enable the ASYNC dispatcher type for all filters provided with
+ the Spring Framework since they will not get involved in async
+ dispatches unless needed.
+
+ If using Servlet 3, Java based configuration, e.g. via
+ WebApplicationInitializer, you'll
+ also need to set the "asyncSupported" flag as well as the
+ ASYNC dispatcher type just like with web.xml.
+ To simplify all this configuration, consider
+ extending AbstractDispatcherServletInitializer
+ or AbstractAnnotationConfigDispatcherServletInitializer,
+ which automatically set those options and make it very easy to register
+ Filter instances.
+
+
+
+ Spring MVC Async Config
+
+ The MVC Java config and the MVC namespace both provide options for
+ configuring async request processing.
+ WebMvcConfigurer has the method
+ configureAsyncSupport while <mvc:annotation-driven>
+ has an <async-support> sub-element.
+
+ Those allow you to configure the default timeout value to use for
+ async requests, which if not set depends on the underlying Servlet
+ container (e.g. 10 seconds on Tomcat). You can also configure an
+ AsyncTaskExecutor to use for executing
+ Callable instances returned from
+ controller methods. It is highly recommended to configure this property
+ since by default Spring MVC uses
+ SimpleAsyncTaskExecutor. The MVC Java config
+ and the MVC namespace also allow you to register
+ CallableProcessingInterceptor and
+ DeferredResultProcessingInterceptor
+ instances.
+
+ If you need to override the default timeout value for a
+ specific DeferredResult, you can do so by using
+ the appropriate class constructor. Similarly, for a
+ Callable, you can wrap it in a
+ WebAsyncTask and use the appropriate class
+ constructor to customize the timeout value. The class constructor of
+ WebAsyncTask also allows providing
+ an AsyncTaskExecutor.
+
+
@@ -5037,7 +5077,7 @@ public class WebConfig extends WebMvcConfigurerAdapter {
.rss, and .atom if the
corresponding dependencies such as Jackson, JAXB2, or Rome
are present on the classpath. Additional extensions may be not need
- to be registered explicitly if they can be discovered via
+ to be registered explicitly if they can be discovered via
ServletContext.getMimeType(String) or the
Java Activation Framework
(see javax.activation.MimetypesFileTypeMap).