You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by vi...@apache.org on 2017/04/12 15:34:26 UTC

svn commit: r1791134 - in /tomcat/trunk: java/org/apache/coyote/Response.java webapps/docs/changelog.xml

Author: violetagg
Date: Wed Apr 12 15:34:26 2017
New Revision: 1791134

URL: http://svn.apache.org/viewvc?rev=1791134&view=rev
Log:
When there is no javax.servlet.WriteListener registered then a call to javax.servlet.ServletOutputStream#isReady will return 'false' instead of throwing IllegalStateException.

Modified:
    tomcat/trunk/java/org/apache/coyote/Response.java
    tomcat/trunk/webapps/docs/changelog.xml

Modified: tomcat/trunk/java/org/apache/coyote/Response.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/Response.java?rev=1791134&r1=1791133&r2=1791134&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/Response.java (original)
+++ tomcat/trunk/java/org/apache/coyote/Response.java Wed Apr 12 15:34:26 2017
@@ -25,6 +25,8 @@ import java.util.concurrent.atomic.Atomi
 
 import javax.servlet.WriteListener;
 
+import org.apache.juli.logging.Log;
+import org.apache.juli.logging.LogFactory;
 import org.apache.tomcat.util.buf.MessageBytes;
 import org.apache.tomcat.util.http.MimeHeaders;
 import org.apache.tomcat.util.http.parser.MediaType;
@@ -44,6 +46,8 @@ public final class Response {
 
     private static final StringManager sm = StringManager.getManager(Response.class);
 
+    private static final Log log = LogFactory.getLog(Response.class);
+
     // ----------------------------------------------------- Class Variables
 
     /**
@@ -614,7 +618,10 @@ public final class Response {
 
     public boolean isReady() {
         if (listener == null) {
-            throw new IllegalStateException(sm.getString("response.notNonBlocking"));
+            if (log.isDebugEnabled()) {
+                log.debug(sm.getString("response.notNonBlocking"));
+            }
+            return false;
         }
         // Assume write is not possible
         boolean ready = false;

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1791134&r1=1791133&r2=1791134&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Wed Apr 12 15:34:26 2017
@@ -90,6 +90,12 @@
         logging during shutdown, some of which have been observed when running
         the unit tests. (markt)
       </fix>
+      <fix>
+        When there is no <code>javax.servlet.WriteListener</code> registered
+        then a call to <code>javax.servlet.ServletOutputStream#isReady</code>
+        will return <code>false</code> instead of throwing
+        <code>IllegalStateException</code>. (violetagg)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Re: svn commit: r1791134 - in /tomcat/trunk: java/org/apache/coyote/Response.java webapps/docs/changelog.xml

Posted by Violeta Georgieva <mi...@gmail.com>.
2017-04-12 18:36 GMT+03:00 Mark Thomas <ma...@apache.org>:
>
> On 12/04/17 16:34, violetagg@apache.org wrote:
> > Author: violetagg
> > Date: Wed Apr 12 15:34:26 2017
> > New Revision: 1791134
> >
> > URL: http://svn.apache.org/viewvc?rev=1791134&view=rev
> > Log:
> > When there is no javax.servlet.WriteListener registered then a call to
javax.servlet.ServletOutputStream#isReady will return 'false' instead of
throwing IllegalStateException.
>
> What about the ReadListener?
>

give me a moment to check

"
boolean isReady(). The isReady method returns true if data can be read
without blocking. If no data can be read without blocking it returns false.
If isReady returns false it is illegal to call the read method and an
IllegalStateException MUST be thrown.
"

> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>

Re: svn commit: r1791134 - in /tomcat/trunk: java/org/apache/coyote/Response.java webapps/docs/changelog.xml

Posted by Violeta Georgieva <mi...@gmail.com>.
2017-04-12 18:36 GMT+03:00 Mark Thomas <ma...@apache.org>:
>
> On 12/04/17 16:34, violetagg@apache.org wrote:
> > Author: violetagg
> > Date: Wed Apr 12 15:34:26 2017
> > New Revision: 1791134
> >
> > URL: http://svn.apache.org/viewvc?rev=1791134&view=rev
> > Log:
> > When there is no javax.servlet.WriteListener registered then a call to
javax.servlet.ServletOutputStream#isReady will return 'false' instead of
throwing IllegalStateException.
>
> What about the ReadListener?

done

>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>

Re: svn commit: r1791134 - in /tomcat/trunk: java/org/apache/coyote/Response.java webapps/docs/changelog.xml

Posted by Mark Thomas <ma...@apache.org>.
On 12/04/17 16:34, violetagg@apache.org wrote:
> Author: violetagg
> Date: Wed Apr 12 15:34:26 2017
> New Revision: 1791134
> 
> URL: http://svn.apache.org/viewvc?rev=1791134&view=rev
> Log:
> When there is no javax.servlet.WriteListener registered then a call to javax.servlet.ServletOutputStream#isReady will return 'false' instead of throwing IllegalStateException.

What about the ReadListener?

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org