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

[tor-commits] [onionoo/master] Simplify URL check a bit.



commit e034adf8d7b1a8b50b81ca4e58e63a751080a6a9
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Tue Jul 24 16:14:16 2012 +0200

    Simplify URL check a bit.
---
 etc/web.xml.template                            |    6 +++---
 src/org/torproject/onionoo/ResourceServlet.java |    9 +++------
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/etc/web.xml.template b/etc/web.xml.template
index 4cba2b5..b2c3178 100644
--- a/etc/web.xml.template
+++ b/etc/web.xml.template
@@ -18,15 +18,15 @@
   </servlet>
   <servlet-mapping>
     <servlet-name>Resource</servlet-name>
-    <url-pattern>/summary/*</url-pattern>
+    <url-pattern>/summary</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
     <servlet-name>Resource</servlet-name>
-    <url-pattern>/details/*</url-pattern>
+    <url-pattern>/details</url-pattern>
   </servlet-mapping>
   <servlet-mapping>
     <servlet-name>Resource</servlet-name>
-    <url-pattern>/bandwidth/*</url-pattern>
+    <url-pattern>/bandwidth</url-pattern>
   </servlet-mapping>
 
 </web-app>
diff --git a/src/org/torproject/onionoo/ResourceServlet.java b/src/org/torproject/onionoo/ResourceServlet.java
index 43c2110..7fddbea 100644
--- a/src/org/torproject/onionoo/ResourceServlet.java
+++ b/src/org/torproject/onionoo/ResourceServlet.java
@@ -160,14 +160,11 @@ public class ResourceServlet extends HttpServlet {
       uri = uri.substring("/onionoo".length());
     }
     String resourceType = null;
-    if (uri.startsWith("/summary") &&
-        !uri.startsWith("/summary/")) {
+    if (uri.startsWith("/summary")) {
       resourceType = "summary";
-    } else if (uri.startsWith("/details") &&
-        !uri.startsWith("/details/")) {
+    } else if (uri.startsWith("/details")) {
       resourceType = "details";
-    } else if (uri.startsWith("/bandwidth") &&
-        !uri.startsWith("/bandwidth/")) {
+    } else if (uri.startsWith("/bandwidth")) {
       resourceType = "bandwidth";
     } else {
       response.sendError(HttpServletResponse.SC_BAD_REQUEST);

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