commit 9b42e1712595546144fe56e3e0afdc58388e492c Author: Iain R. Learmonth irl@fsfe.org Date: Thu Feb 15 13:00:57 2018 +0000
Adds RelaySearchServlet and accompanying JSP (Fixes: #25258) --- .../torproject/metrics/web/RelaySearchServlet.java | 33 ++++++++++++++++ src/main/resources/web/jsps/rs.jsp | 44 ++++++++++++++++++++++ 2 files changed, 77 insertions(+)
diff --git a/src/main/java/org/torproject/metrics/web/RelaySearchServlet.java b/src/main/java/org/torproject/metrics/web/RelaySearchServlet.java new file mode 100644 index 0000000..9a235ce --- /dev/null +++ b/src/main/java/org/torproject/metrics/web/RelaySearchServlet.java @@ -0,0 +1,33 @@ +/* Copyright 2011--2018 The Tor Project + * See LICENSE for licensing information */ + +package org.torproject.metrics.web; + +import java.io.IOException; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class RelaySearchServlet extends AnyServlet { + + private static final long serialVersionUID = 1L; + + @Override + public void init() throws ServletException { + super.init(); + } + + @Override + public void doGet(HttpServletRequest request, + HttpServletResponse response) throws IOException, ServletException { + + /* Forward the request to the JSP that does all the hard work. */ + String[] additionalStylesheets = {"/rs/css/atlas.css"}; + request.setAttribute("additionalStylesheets", additionalStylesheets); + request.setAttribute("categories", this.categories); + request.getRequestDispatcher("WEB-INF/rs.jsp").forward(request, + response); + } +} + diff --git a/src/main/resources/web/jsps/rs.jsp b/src/main/resources/web/jsps/rs.jsp new file mode 100644 index 0000000..22a8377 --- /dev/null +++ b/src/main/resources/web/jsps/rs.jsp @@ -0,0 +1,44 @@ +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<jsp:include page="top.jsp"> + <jsp:param name="pageTitle" value="Relay Search"/> + <jsp:param name="navActive" value="Services"/> +</jsp:include> + +<div class="container"> + <ul class="breadcrumb"> + <li><a href="/">Home</a></li> + <li><a href="/services.html">Services</a></li> + <li class="active">Relay Search</li> + </ul> + <form class="hidden-xs navbar-form pull-right" role="search" id="secondary-search"> + <div class="input-group add-on"> + <input class="form-control" placeholder="Search" name="secondary-search-query" id="secondary-search-query" type="text" autocorrect="off" autocapitalize="none"> + <div class="input-group-btn"> + <button class="btn btn-danger" id="secondary-search-clear" type="button" title="Clear Search Query"><i class="glyphicon glyphicon-remove-circle"></i></button> + <button class="btn btn-primary" id="secondary-search-submit" type="submit" title="Perform Search"><i class="glyphicon glyphicon-search"></i></button> + <button class="btn btn-secondary" id="secondary-search-aggregate" type="button" title="Perform Aggregated Search"><i class="fa fa-compress"></i></button> + </div> + </div> + </form> + <h1>Relay Search</h1> + <div class="progress progress-info progress-striped active"> + <div class="progress-bar">Rendering results...</div> + </div> + <div id="content"> + <noscript> + <div class="alert alert-warning"> + <p><strong>JavaScript required</strong><br> + Please enable JavaScript to use this service. If you are using Tor Browser on High Security mode, it is possible to enable JavaScript to run only on this page. Click the NoScript <img src="img/noscript.png"> icon on your address bar and select "Temporarily allow all on this page". Relay Search only uses JavaScript resources that are hosted by the Tor Metrics team.</p> + </noscript> + </div> +</div> <!-- /container --> + +<script> + var require = { + urlArgs: "v29" + }; +</script> +<script data-main="/rs/js/main" src="/rs/js/libs/require/require.js"></script> + +<jsp:include page="bottom.jsp"/>
tor-commits@lists.torproject.org