[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [metrics-web/master] Flush and close output streams.



commit 57a5a9994e6b62f03f1f6c7bff69637caaed066d
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Thu Jul 21 14:46:21 2011 +0200

    Flush and close output streams.
    
    Apparently, Tomcat 5 didn't care about this.  But Tomcat 6 does.
---
 src/org/torproject/ernie/web/ConsensusServlet.java |    2 ++
 .../ernie/web/ExtraInfoDescriptorServlet.java      |    2 ++
 .../torproject/ernie/web/GraphImageServlet.java    |    1 +
 .../ernie/web/ServerDescriptorServlet.java         |    2 ++
 src/org/torproject/ernie/web/VotesServlet.java     |    2 ++
 5 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/src/org/torproject/ernie/web/ConsensusServlet.java b/src/org/torproject/ernie/web/ConsensusServlet.java
index eade324..d9a6ae1 100644
--- a/src/org/torproject/ernie/web/ConsensusServlet.java
+++ b/src/org/torproject/ernie/web/ConsensusServlet.java
@@ -96,6 +96,8 @@ public class ConsensusServlet extends HttpServlet {
       BufferedOutputStream output = new BufferedOutputStream(
           response.getOutputStream());
       output.write(rawDescriptor);
+      output.flush();
+      output.close();
     } finally {
       /* Nothing to do here. */
     }
diff --git a/src/org/torproject/ernie/web/ExtraInfoDescriptorServlet.java b/src/org/torproject/ernie/web/ExtraInfoDescriptorServlet.java
index 855801e..8ba33be 100644
--- a/src/org/torproject/ernie/web/ExtraInfoDescriptorServlet.java
+++ b/src/org/torproject/ernie/web/ExtraInfoDescriptorServlet.java
@@ -85,6 +85,8 @@ public class ExtraInfoDescriptorServlet extends HttpServlet {
       BufferedOutputStream output = new BufferedOutputStream(
           response.getOutputStream());
       output.write(rawDescriptor);
+      output.flush();
+      output.close();
     } finally {
       /* Nothing to do here. */
     }
diff --git a/src/org/torproject/ernie/web/GraphImageServlet.java b/src/org/torproject/ernie/web/GraphImageServlet.java
index db9eaaa..2eb2efd 100644
--- a/src/org/torproject/ernie/web/GraphImageServlet.java
+++ b/src/org/torproject/ernie/web/GraphImageServlet.java
@@ -96,6 +96,7 @@ public class GraphImageServlet extends HttpServlet {
         "inline; filename=\"" + imageFilename + "\"");
     output = new BufferedOutputStream(response.getOutputStream(), 1024);
     output.write(graphBytes, 0, graphBytes.length);
+    output.flush();
     output.close();
   }
 }
diff --git a/src/org/torproject/ernie/web/ServerDescriptorServlet.java b/src/org/torproject/ernie/web/ServerDescriptorServlet.java
index c8b45be..960bd75 100644
--- a/src/org/torproject/ernie/web/ServerDescriptorServlet.java
+++ b/src/org/torproject/ernie/web/ServerDescriptorServlet.java
@@ -86,6 +86,8 @@ public class ServerDescriptorServlet extends HttpServlet {
       BufferedOutputStream output = new BufferedOutputStream(
           response.getOutputStream());
       output.write(rawDescriptor);
+      output.flush();
+      output.close();
     } finally {
       /* Nothing to do here. */
     }
diff --git a/src/org/torproject/ernie/web/VotesServlet.java b/src/org/torproject/ernie/web/VotesServlet.java
index 3af9705..6755495 100644
--- a/src/org/torproject/ernie/web/VotesServlet.java
+++ b/src/org/torproject/ernie/web/VotesServlet.java
@@ -102,6 +102,8 @@ public class VotesServlet extends HttpServlet {
       for (byte[] rawDescriptor : rawDescriptors) {
         output.write(rawDescriptor);
       }
+      output.flush();
+      output.close();
     } finally {
       /* Nothing to do here. */
     }



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits