tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r533881 - /tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java
Date Mon, 30 Apr 2007 23:36:11 GMT
Author: remm
Date: Mon Apr 30 16:36:10 2007
New Revision: 533881

URL: http://svn.apache.org/viewvc?view=rev&rev=533881
Log:
- New read loop (much more conventional using the more accurate InputStream.available() method).

Modified:
    tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java

Modified: tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java?view=diff&rev=533881&r1=533880&r2=533881
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java (original)
+++ tomcat/tc6.0.x/trunk/webapps/examples/WEB-INF/classes/chat/ChatServlet.java Mon Apr 30
16:36:10 2007
@@ -149,16 +149,18 @@
         throws IOException, ServletException {
         InputStream is = request.getInputStream();
         byte[] buf = new byte[512];
-        do {
+        while (is.available() > 0) {
+            log("Available: " + is.available());
             int n = is.read(buf);
             if (n > 0) {
                 log("Read " + n + " bytes: " + new String(buf, 0, n) 
                         + " for session: " + request.getSession(true).getId());
             } else if (n < 0) {
-                error(event, request, response);
+                log("End of file: " + n);
+                end(event, request, response);
                 return;
             }
-        } while (is.available() > 0);
+        }
     }
 
     protected void service(HttpServletRequest request, HttpServletResponse response)



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


Mime
View raw message