Update reference doc for async web request config
Issue: SPR-9400
This commit is contained in:
parent
c209b6700a
commit
26b1f44ce7
|
|
@ -2490,7 +2490,7 @@ deferredResult.setResult(data);
|
|||
</para>
|
||||
|
||||
<section xml:id="mvc-ann-async-exceptions">
|
||||
<title>Async Request Processing and Exception Handling</title>
|
||||
<title>Exception Handling for Async Requests</title>
|
||||
|
||||
<para>What happens if a <interfacename>Callable</interfacename> returned
|
||||
from a controller method raises an Exception while being executed?
|
||||
|
|
@ -2560,9 +2560,49 @@ deferredResult.setResult(data);
|
|||
</section>
|
||||
|
||||
<section xml:id="mvc-ann-async-configuration">
|
||||
<title>Async Request Configuration</title>
|
||||
<title>Configuration for Async Request Processing</title>
|
||||
|
||||
<para>The MVC Java config and the MVC namespace provide options for
|
||||
<section xml:id="mvc-ann-async-configuration-servlet3">
|
||||
<title>Servlet 3 Async Config</title>
|
||||
|
||||
<para>To use Servlet 3 async request processing, you need to update
|
||||
<filename>web.xml</filename> to version 3.0:</para>
|
||||
|
||||
<programlisting language="xml"><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>
|
||||
</programlisting>
|
||||
|
||||
<para>The <classname>DispatcherServlet</classname> and any
|
||||
<interfacename>Filter</interfacename> configuration need to have
|
||||
the <code><async-supported>true</async-supported></code> sub-element.
|
||||
Additionally, any <interfacename>Filter</interfacename> 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.</para>
|
||||
|
||||
<para>If using Servlet 3, Java based configuration, e.g. via
|
||||
<interfacename>WebApplicationInitializer</interfacename>, you'll
|
||||
also need to set the "asyncSupported" flag as well as the
|
||||
ASYNC dispatcher type just like with <filename>web.xml</filename>.
|
||||
To simplify all this configuration, consider
|
||||
extending <classname>AbstractDispatcherServletInitializer</classname>
|
||||
or <classname>AbstractAnnotationConfigDispatcherServletInitializer</classname>,
|
||||
which automatically set those options and make it very easy to register
|
||||
<interfacename>Filter</interfacename> instances.</para>
|
||||
</section>
|
||||
|
||||
<section xml:id="mvc-ann-async-configuration-spring-mvc">
|
||||
<title>Spring MVC Async Config</title>
|
||||
|
||||
<para>The MVC Java config and the MVC namespace both provide options for
|
||||
configuring async request processing.
|
||||
<interfacename>WebMvcConfigurer</interfacename> has the method
|
||||
<code>configureAsyncSupport</code> while <mvc:annotation-driven>
|
||||
|
|
@ -2589,10 +2629,10 @@ deferredResult.setResult(data);
|
|||
constructor to customize the timeout value. The class constructor of
|
||||
<classname>WebAsyncTask</classname> also allows providing
|
||||
an <interfacename>AsyncTaskExecutor</interfacename>.</para>
|
||||
|
||||
</section>
|
||||
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section xml:id="mvc-ann-tests">
|
||||
<title>Testing Controllers</title>
|
||||
|
|
|
|||
Loading…
Reference in New Issue