On 14/06/2013 07:00, Violeta Georgieva wrote:
2013/6/11 <ma...@apache.org>
Author: markt
Date: Tue Jun 11 20:18:10 2013
New Revision: 1491940
URL: http://svn.apache.org/r1491940
Log:
Servlet 3.1 requires an ISE if getRequest() or getResponse() are called
after complete() or dispatch()
Modified:
tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties
tomcat/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java
Modified: tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java?rev=1491940&r1=1491939&r2=1491940&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/AsyncContextImpl.java Tue
Jun 11 20:18:10 2013
@@ -64,8 +64,8 @@ public class AsyncContextImpl implements
protected static final StringManager sm =
StringManager.getManager(Constants.Package);
- private ServletRequest servletRequest = null;
- private ServletResponse servletResponse = null;
+ private volatile ServletRequest servletRequest = null;
+ private volatile ServletResponse servletResponse = null;
private final List<AsyncListenerWrapper> listeners = new
ArrayList<>();
private boolean hasOriginalRequestAndResponse = true;
private volatile Runnable dispatch = null;
@@ -90,6 +90,7 @@ public class AsyncContextImpl implements
check();
request.getCoyoteRequest().action(ActionCode.COMMIT, null);
request.getCoyoteRequest().action(ActionCode.ASYNC_COMPLETE,
null);
+ clearServletRequestResposne();
}
Is that mean that if I have AsyncListener that does some work in
onComplete() then I will not be able to use the request and response
objects?
Yes and no. You can't call getRequest() or getResponse() on the
AsyncContext but you can get the objects from getSuppliedRequest() and
getSuppliedResposne() on the AsyncEvent object.
The Tomcat unit tests were updated to do things this way as a number of
them started failing as they were calling getRequest() or getResponse()
during onComplete()
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org