You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by vg...@apache.org on 2005/10/17 20:45:00 UTC

svn commit: r325955 - in /cocoon/trunk: src/java/org/apache/cocoon/servlet/CocoonServlet.java status.xml

Author: vgritsenko
Date: Mon Oct 17 11:44:53 2005
New Revision: 325955

URL: http://svn.apache.org/viewcvs?rev=325955&view=rev
Log:
    <action dev="VG" type="fix" fixes-bug="35905">
      Do not flush and close output stream, servlet container
      will take care of it.
    </action>


Modified:
    cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java
    cocoon/trunk/status.xml

Modified: cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java?rev=325955&r1=325954&r2=325955&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/servlet/CocoonServlet.java Mon Oct 17 11:44:53 2005
@@ -457,24 +457,23 @@
                 getLogger().error("Cocoon got an Exception while trying to cleanup the uploaded files.", e);
             }
 
-            try {
-                OutputStream out = res.getOutputStream();
-                out.flush();
-                out.close();
-            } catch (SocketException se) {
-                if (getLogger().isDebugEnabled()) {
-                    getLogger().debug("SocketException while trying to close stream.", se);
-                } else if (getLogger().isWarnEnabled()) {
-                    getLogger().warn("SocketException while trying to close stream.");
-                }
-            } catch (IOException e) {
-                // See: http://marc.theaimsgroup.com/?l=xml-cocoon-dev&m=107489037219505
-                if (getLogger().isDebugEnabled()) {
-                    getLogger().debug("IOException while trying to close stream.", e);
-                }
-            } catch (Exception e) {
-                getLogger().error("Exception while trying to close stream.", e);
-            }
+            /*
+             * Servlet Specification 2.2, 6.5 Closure of Response Object:
+             *
+             *   A number of events can indicate that the servlet has provided all of the
+             *   content to satisfy the request and that the response object can be
+             *   considered to be closed. The events are:
+             *     o The termination of the service method of the servlet.
+             *     o When the amount of content specified in the setContentLength method
+             *       of the response has been written to the response.
+             *     o The sendError method is called.
+             *     o The sendRedirect method is called.
+             *   When a response is closed, all content in the response buffer, if any remains,
+             *   must be immediately flushed to the client.
+             *
+             * Due to the above, out.flush() and out.close() are not necessary, and sometimes
+             * (if sendError or sendRedirect were used) request may be already closed.
+             */
         }
     }
 

Modified: cocoon/trunk/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?rev=325955&r1=325954&r2=325955&view=diff
==============================================================================
--- cocoon/trunk/status.xml (original)
+++ cocoon/trunk/status.xml Mon Oct 17 11:44:53 2005
@@ -560,9 +560,13 @@
    </action>
   </release>
   <release version="2.1.8" date="TBD">
+    <action dev="VG" type="fix" fixes-bug="35905">
+      Do not flush and close output stream, servlet container
+      will take care of it.
+    </action>
     <action dev="CZ" type="add">
-      Portal Block: Include coplet instance id in window renderer; ignore javascript: urls during
-                    url rewriting.
+      Portal Block: Include coplet instance id in window renderer; ignore
+      javascript: urls during url rewriting.
     </action>
     <action dev="RG" type="fix" fixes-bug="32784">
       Portal Block: Allow Full screen mode to show navigation.