You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2016/04/07 21:39:23 UTC
svn commit: r1738181 - in /tomcat/tc8.5.x/trunk: ./ java/javax/servlet/
java/org/apache/catalina/connector/ java/org/apache/catalina/core/
webapps/docs/
Author: markt
Date: Thu Apr 7 19:39:23 2016
New Revision: 1738181
URL: http://svn.apache.org/viewvc?rev=1738181&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=59261
ServletRequest.getAsyncContext() now throws an IllegalStateException as required by the Servlet specification if the request is not in asynchronous mode when called.
Modified:
tomcat/tc8.5.x/trunk/ (props changed)
tomcat/tc8.5.x/trunk/java/javax/servlet/ServletRequest.java
tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/LocalStrings.properties
tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Request.java
tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/StandardWrapperValve.java
tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml
Propchange: tomcat/tc8.5.x/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Apr 7 19:39:23 2016
@@ -1 +1 @@
-/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738174-1738175
+/tomcat/trunk:1734785,1734799,1734845,1734928,1735041,1735044,1735480,1735577,1735597,1735599-1735600,1735615,1736145,1736162,1736209,1736280,1736297,1736299,1736489,1736646,1736703,1736836,1736849,1737104-1737105,1737112,1737117,1737119-1737120,1737155,1737157,1737192,1737280,1737339,1737632,1737664,1737715,1737748,1737785,1737834,1737860,1737959,1738005,1738007,1738014-1738015,1738018,1738022,1738039,1738043,1738059-1738060,1738147,1738149,1738174-1738175
Modified: tomcat/tc8.5.x/trunk/java/javax/servlet/ServletRequest.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/javax/servlet/ServletRequest.java?rev=1738181&r1=1738180&r2=1738181&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/javax/servlet/ServletRequest.java (original)
+++ tomcat/tc8.5.x/trunk/java/javax/servlet/ServletRequest.java Thu Apr 7 19:39:23 2016
@@ -482,9 +482,14 @@ public interface ServletRequest {
public boolean isAsyncSupported();
/**
- * @return TODO
+ * Get the current AsyncContext.
+ *
+ * @return The current AsyncContext
+ *
* @throws IllegalStateException if the request is not in asynchronous mode
- * @since Servlet 3.0 TODO SERVLET3 - Add comments
+ * (i.e. @link #isAsyncStarted() is {@code false})
+ *
+ * @since Servlet 3.0
*/
public AsyncContext getAsyncContext();
Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1738181&r1=1738180&r2=1738181&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Thu Apr 7 19:39:23 2016
@@ -136,7 +136,7 @@ public class CoyoteAdapter implements Ad
"Dispatch may only happen on an existing request.");
}
boolean success = true;
- AsyncContextImpl asyncConImpl = (AsyncContextImpl)request.getAsyncContext();
+ AsyncContextImpl asyncConImpl = request.getAsyncContextInternal();
req.getRequestProcessor().setWorkerThreadName(Thread.currentThread().getName());
try {
if (!request.isAsync()) {
Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/LocalStrings.properties
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/LocalStrings.properties?rev=1738181&r1=1738180&r2=1738181&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/LocalStrings.properties (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/LocalStrings.properties Thu Apr 7 19:39:23 2016
@@ -71,6 +71,7 @@ outputBuffer.writeNull=The String argume
request.asyncNotSupported=A filter or servlet of the current chain does not support asynchronous operations.
request.illegalWrap=The request wrapper must wrap the request obtained from getRequest()
+request.notAsync=It is illegal to call this method if the current request is not in asynchronous mode (i.e. isAsyncStarted() returns false)
requestFacade.nullRequest=The request object has been recycled and is no longer associated with this facade
Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Request.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Request.java?rev=1738181&r1=1738180&r2=1738181&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Request.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/connector/Request.java Thu Apr 7 19:39:23 2016
@@ -408,7 +408,7 @@ public class Request implements HttpServ
/**
* AsyncContext
*/
- protected volatile AsyncContextImpl asyncContext = null;
+ private volatile AsyncContextImpl asyncContext = null;
protected Boolean asyncSupported = null;
@@ -1689,7 +1689,14 @@ public class Request implements HttpServ
@Override
public AsyncContext getAsyncContext() {
- return this.asyncContext;
+ if (!isAsyncStarted()) {
+ throw new IllegalStateException(sm.getString("request.notAsync"));
+ }
+ return asyncContext;
+ }
+
+ public AsyncContextImpl getAsyncContextInternal() {
+ return asyncContext;
}
@Override
Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java?rev=1738181&r1=1738180&r2=1738181&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/ApplicationDispatcher.java Thu Apr 7 19:39:23 2016
@@ -375,7 +375,7 @@ final class ApplicationDispatcher implem
processRequest(request,response,state);
}
- if (request.getAsyncContext() != null) {
+ if (request.isAsyncStarted()) {
// An async request was started during the forward, don't close the
// response as it may be written to during the async handling
return;
Modified: tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/StandardWrapperValve.java
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/StandardWrapperValve.java?rev=1738181&r1=1738180&r2=1738181&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/StandardWrapperValve.java (original)
+++ tomcat/tc8.5.x/trunk/java/org/apache/catalina/core/StandardWrapperValve.java Thu Apr 7 19:39:23 2016
@@ -180,7 +180,7 @@ final class StandardWrapperValve
try {
SystemLogHandler.startCapture();
if (request.isAsyncDispatching()) {
- ((AsyncContextImpl)request.getAsyncContext()).doInternalDispatch();
+ request.getAsyncContextInternal().doInternalDispatch();
} else {
filterChain.doFilter(request.getRequest(),
response.getResponse());
@@ -193,7 +193,7 @@ final class StandardWrapperValve
}
} else {
if (request.isAsyncDispatching()) {
- ((AsyncContextImpl)request.getAsyncContext()).doInternalDispatch();
+ request.getAsyncContextInternal().doInternalDispatch();
} else {
filterChain.doFilter
(request.getRequest(), response.getResponse());
Modified: tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml?rev=1738181&r1=1738180&r2=1738181&view=diff
==============================================================================
--- tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc8.5.x/trunk/webapps/docs/changelog.xml Thu Apr 7 19:39:23 2016
@@ -103,6 +103,12 @@
<code>TransientAttribute</code>. (kfujino)
</fix>
<fix>
+ <bug>59261</bug>: <code>ServletRequest.getAsyncContext()</code> now
+ throws an <code>IllegalStateException</code> as required by the Servlet
+ specification if the request is not in asynchronous mode when called.
+ (markt)
+ </fix>
+ <fix>
<bug>59269</bug>: Correct the implementation of
<code>PersistentManagerBase</code> so that <code>minIdleSwap</code>
functions as designed and sessions are swapped out to keep the active
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org