[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [metrics-web/master] Simplify note that consensus-health has moved.
commit 890b6c9624edf46d31f742ab42ec5f838f3e03eb
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date: Wed Jan 22 13:06:47 2014 +0100
Simplify note that consensus-health has moved.
---
.../metrics/web/status/ConsensusHealthServlet.java | 45 +++-----------------
website/web/WEB-INF/consensus-health.jsp | 26 +++++++++++
2 files changed, 32 insertions(+), 39 deletions(-)
diff --git a/website/src/org/torproject/metrics/web/status/ConsensusHealthServlet.java b/website/src/org/torproject/metrics/web/status/ConsensusHealthServlet.java
index d693349..3bed511 100644
--- a/website/src/org/torproject/metrics/web/status/ConsensusHealthServlet.java
+++ b/website/src/org/torproject/metrics/web/status/ConsensusHealthServlet.java
@@ -1,11 +1,7 @@
-/* Copyright 2011, 2012 The Tor Project
+/* Copyright 2011--2014 The Tor Project
* See LICENSE for licensing information */
package org.torproject.metrics.web.status;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
import java.io.IOException;
import javax.servlet.ServletException;
@@ -15,43 +11,14 @@ import javax.servlet.http.HttpServletResponse;
public class ConsensusHealthServlet extends HttpServlet {
- private static final long serialVersionUID = -5230032733057814869L;
+ private static final long serialVersionUID = 8349991221914797433L;
public void doGet(HttpServletRequest request,
- HttpServletResponse response) throws IOException,
- ServletException {
+ HttpServletResponse response) throws IOException, ServletException {
- /* Read file from disk and write it to response. */
- BufferedInputStream input = null;
- BufferedOutputStream output = null;
- try {
- File f = new File("/srv/metrics.torproject.org/ernie/website/"
- + "consensus-health.html");
- if (!f.exists()) {
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- return;
- }
- response.setContentType(this.getServletContext().getMimeType(f.getName()));
- response.setHeader("Content-Length", String.valueOf(
- f.length()));
- response.setHeader("Content-Disposition",
- "inline; filename=\"" + f.getName() + "\"");
- input = new BufferedInputStream(new FileInputStream(f),
- 1024);
- output = new BufferedOutputStream(response.getOutputStream(), 1024);
- byte[] buffer = new byte[1024];
- int length;
- while ((length = input.read(buffer)) > 0) {
- output.write(buffer, 0, length);
- }
- } finally {
- if (output != null) {
- output.close();
- }
- if (input != null) {
- input.close();
- }
- }
+ /* Forward the request to the JSP that does all the hard work. */
+ request.getRequestDispatcher("WEB-INF/consensus-health.jsp").forward(
+ request, response);
}
}
diff --git a/website/web/WEB-INF/consensus-health.jsp b/website/web/WEB-INF/consensus-health.jsp
new file mode 100644
index 0000000..d802b65
--- /dev/null
+++ b/website/web/WEB-INF/consensus-health.jsp
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<html>
+<head>
+ <title>Tor Metrics Portal: Consensus health</title>
+ <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
+ <link href="/css/stylesheet-ltr.css" type="text/css" rel="stylesheet">
+ <link href="/images/favicon.ico" type="image/x-icon" rel="shortcut icon">
+</head>
+<body>
+ <div class="center">
+ <%@ include file="banner.jsp"%>
+ <div class="main-column" style="margin:5; Padding:0;">
+ <h2>Tor Metrics Portal: Consensus Health</h2>
+ <br>
+ <p>This page shows statistics about the current consensus and votes to
+ facilitate debugging of the directory consensus process.</p>
+ <br>
+ <p><font color="red"><b>Notice:</b> This service has moved to:
+ <a href="https://consensus-health.torproject.org/">https://consensus-health.torproject.org/</a></font></p>
+ </div>
+ </div>
+ <div class="bottom" id="bottom">
+ <%@ include file="footer.jsp"%>
+ </div>
+</body>
+</html>
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits