cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r687110 - /cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
Date Tue, 19 Aug 2008 17:56:14 GMT
Author: reinhard
Date: Tue Aug 19 10:56:13 2008
New Revision: 687110

URL: http://svn.apache.org/viewvc?rev=687110&view=rev
Log:
don't write null content into the response output stream. This leads to unexpected behaviour
in the case of e.g. a 401 response

Modified:
    cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java

Modified: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java?rev=687110&r1=687109&r2=687110&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
Tue Aug 19 10:56:13 2008
@@ -141,14 +141,17 @@
                 response.setContentType(mimeType);
             }
 
-            response.setContentLength(contentLengh);
             response.setStatus(statusCode);
-            if (this.logger.isInfoEnabled()) {
-                this.logger.info("Going to send response: mimeType=" + mimeType + ", contentLength="
+ contentLengh
-                        + ", statusCode=" + statusCode + ", lastModified=" + lastModified);
-            }
 
-            response.getOutputStream().write(baos.toByteArray());
+            if (contentLengh > 0) {
+                response.setContentLength(contentLengh);
+                if (this.logger.isInfoEnabled()) {
+                    this.logger.info("Going to send response: mimeType=" + mimeType + ",
contentLength=" + contentLengh
+                            + ", statusCode=" + statusCode + ", lastModified=" + lastModified);
+                }
+
+                response.getOutputStream().write(baos.toByteArray());
+            }
         } catch (Exception e) {
             String msg = "An exception occurred while executing the sitemap.";
             this.logger.error(msg, e);



Mime
View raw message