[onionoo/master] Allow the webapp to be deployed as onionoo.war.

commit a835c3cad889e31fbc44b0455936dc61da715f1a Author: Karsten Loesing <karsten.loesing@gmx.net> Date: Mon Apr 2 17:12:49 2012 +0200 Allow the webapp to be deployed as onionoo.war. So far, we assumed that the webapp is deployed as ROOT.war which means URLs are, e.g., /summary/all. Now we allow the webapp to be deployed as onionoo.war which leads to URLs like /onionoo/summary/all. Handle both variants. --- INSTALL | 5 +++-- src/org/torproject/onionoo/ResourceServlet.java | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/INSTALL b/INSTALL index e411d8f..0e6269d 100644 --- a/INSTALL +++ b/INSTALL @@ -123,7 +123,8 @@ re-deploy the application in the future. Run the following commands as root: # cd /var/lib/tomcat6/webapps/ -# ln -s /srv/onionoo/onionoo.war ROOT.war +# ln -s /srv/onionoo/onionoo.war onionoo.war -The Onionoo server should now be available at http://localhost:8080/. +The Onionoo server should now be available at +http://localhost:8080/onionoo/. diff --git a/src/org/torproject/onionoo/ResourceServlet.java b/src/org/torproject/onionoo/ResourceServlet.java index e11c7ac..037657e 100644 --- a/src/org/torproject/onionoo/ResourceServlet.java +++ b/src/org/torproject/onionoo/ResourceServlet.java @@ -122,6 +122,9 @@ public class ResourceServlet extends HttpServlet { } String uri = request.getRequestURI(); + if (uri.startsWith("/onionoo/")) { + uri = uri.substring("/onionoo".length()); + } String resourceType = null; if (uri.startsWith("/summary/")) { resourceType = "summary";
participants (1)
-
karsten@torproject.org