@@ -29960,7 +29960,8 @@ To use Servlet 3 async request processing, you need to update `web.xml` to versi
29960
29960
----
29961
29961
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
29962
29962
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
29963
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
29963
+ http://java.sun.com/xml/ns/javaee
29964
+ http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
29964
29965
version="3.0">
29965
29966
29966
29967
...
@@ -29975,6 +29976,43 @@ ASYNC dispatcher type. Note that it is safe to enable the ASYNC dispatcher type
29975
29976
filters provided with the Spring Framework since they will not get involved in async
29976
29977
dispatches unless needed.
29977
29978
29979
+ [WARNING]
29980
+ ====
29981
+ Note that for some Filters it is absolutely critical to ensure they are mapped to
29982
+ be invoked during asynchronous dispatches. For example if a filter such as the
29983
+ `OpenEntityManagerInViewFilter` is responsible for releasing database connection
29984
+ resources and must be invoked at the end of an async request.
29985
+
29986
+ Below is an example of a propertly configured filter:
29987
+ ====
29988
+
29989
+ [source,xml,indent=0]
29990
+ [subs="verbatim,quotes"]
29991
+ ----
29992
+ <web-app xmlns="http://java.sun.com/xml/ns/javaee"
29993
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
29994
+ xsi:schemaLocation="
29995
+ http://java.sun.com/xml/ns/javaee
29996
+ http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
29997
+ version="3.0">
29998
+
29999
+ <filter>
30000
+ <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
30001
+ <filter-class>org.springframework.~.OpenEntityManagerInViewFilter</filter-class>
30002
+ <async-supported>true</async-supported>
30003
+ </filter>
30004
+
30005
+ <filter-mapping>
30006
+ <filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
30007
+ <url-pattern>/*</url-pattern>
30008
+ <dispatcher>REQUEST</dispatcher>
30009
+ <dispatcher>ASYNC</dispatcher>
30010
+ </filter-mapping>
30011
+
30012
+ </web-app>
30013
+
30014
+ ----
30015
+
29978
30016
If using Servlet 3, Java based configuration, e.g. via `WebApplicationInitializer`,
29979
30017
you'll also need to set the "asyncSupported" flag as well as the ASYNC dispatcher type
29980
30018
just like with `web.xml`. To simplify all this configuration, consider extending
0 commit comments