[tor-commits] [metrics-web/master] Add index for graphs/ directory.

karsten at torproject.org karsten at torproject.org
Thu Sep 20 16:57:38 UTC 2012


commit c295e1609e54cd56e52311910e90c5f48e5c5f18
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Thu Sep 20 12:56:54 2012 -0400

    Add index for graphs/ directory.
---
 src/org/torproject/ernie/web/GraphDataServlet.java |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/org/torproject/ernie/web/GraphDataServlet.java b/src/org/torproject/ernie/web/GraphDataServlet.java
index b574e1c..f8c92bc 100644
--- a/src/org/torproject/ernie/web/GraphDataServlet.java
+++ b/src/org/torproject/ernie/web/GraphDataServlet.java
@@ -94,6 +94,18 @@ public class GraphDataServlet extends HttpServlet {
       HttpServletResponse response) throws IOException,
       ServletException {
 
+    /* Check if the directory listing was requested. */
+    String requestURI = request.getRequestURI();
+    if (requestURI.equals("/ernie/graphs/")) {
+      request.setAttribute("directory", "/graphs");
+      request.setAttribute("extension", "");
+      request.setAttribute("files",
+          this.availableGraphDataFiles.keySet());
+      request.getRequestDispatcher("/WEB-INF/dir.jsp").forward(request,
+          response);
+      return;
+    }
+
     /* Find out which JSON file was requested and make sure we know this
      * JSON file type. */
     String requestedJsonFile = request.getRequestURI();



More information about the tor-commits mailing list