From dd39f3f2447e6beeb0dcd41d93c1ad5ff9adb049 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Fri, 19 Nov 2010 16:14:14 +0000
Subject: [PATCH] i2ptunnel jsp cleanup

---
 apps/i2ptunnel/jsp/editClient.jsp             |  2 +-
 apps/i2ptunnel/jsp/editServer.jsp             |  2 +-
 apps/i2ptunnel/jsp/index.html                 |  2 --
 apps/i2ptunnel/jsp/index.jsp                  | 26 +++++++++----------
 apps/i2ptunnel/jsp/web.xml                    | 13 ++++++++++
 .../i2p/router/web/SummaryBarRenderer.java    |  2 +-
 .../src/net/i2p/router/web/SummaryHelper.java |  2 +-
 apps/routerconsole/jsp/configkeyring.jsp      |  2 +-
 8 files changed, 31 insertions(+), 20 deletions(-)
 delete mode 100644 apps/i2ptunnel/jsp/index.html

diff --git a/apps/i2ptunnel/jsp/editClient.jsp b/apps/i2ptunnel/jsp/editClient.jsp
index be48bb2b92..2b69440ac1 100644
--- a/apps/i2ptunnel/jsp/editClient.jsp
+++ b/apps/i2ptunnel/jsp/editClient.jsp
@@ -29,7 +29,7 @@
     <div id="pageHeader">
     </div>
 
-    <form method="post" action="index.jsp">
+    <form method="post" action="list">
 
         <div id="tunnelEditPanel" class="panel">
             <div class="header">
diff --git a/apps/i2ptunnel/jsp/editServer.jsp b/apps/i2ptunnel/jsp/editServer.jsp
index 97a0a93c9c..773d323a2b 100644
--- a/apps/i2ptunnel/jsp/editServer.jsp
+++ b/apps/i2ptunnel/jsp/editServer.jsp
@@ -29,7 +29,7 @@
     <div id="pageHeader">
     </div>
 
-    <form method="post" action="index.jsp">
+    <form method="post" action="list">
 
         <div id="tunnelEditPanel" class="panel">
             <div class="header">
diff --git a/apps/i2ptunnel/jsp/index.html b/apps/i2ptunnel/jsp/index.html
deleted file mode 100644
index ea1321105e..0000000000
--- a/apps/i2ptunnel/jsp/index.html
+++ /dev/null
@@ -1,2 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><title>I2P Router Console</title></head>
-<body><meta http-equiv="refresh" content="0;url=index.jsp" /><a href="index.jsp">Enter</a></body></html>
diff --git a/apps/i2ptunnel/jsp/index.jsp b/apps/i2ptunnel/jsp/index.jsp
index 8b7f8051ea..cf0d0067c3 100644
--- a/apps/i2ptunnel/jsp/index.jsp
+++ b/apps/i2ptunnel/jsp/index.jsp
@@ -44,7 +44,7 @@
 
         <div class="footer">
             <div class="toolbox">
-                <a class="control" href="index.jsp"><%=intl._("Refresh")%></a>
+                <a class="control" href="list"><%=intl._("Refresh")%></a>
             </div>
         </div>    
     </div>
@@ -53,7 +53,7 @@
         <div class="header"></div>
         <div class="footer">
             <div class="toolbox">
-                <a class="control" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&amp;action=Stop%20all"><%=intl._("Stop All")%></a> <a class="control" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&amp;action=Start%20all"><%=intl._("Start All")%></a> <a class="control" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&amp;action=Restart%20all"><%=intl._("Restart All")%></a> <a class="control" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&amp;action=Reload%20configuration"><%=intl._("Reload Config")%></a>
+                <a class="control" href="list?nonce=<%=indexBean.getNextNonce()%>&amp;action=Stop%20all"><%=intl._("Stop All")%></a> <a class="control" href="list?nonce=<%=indexBean.getNextNonce()%>&amp;action=Start%20all"><%=intl._("Start All")%></a> <a class="control" href="list?nonce=<%=indexBean.getNextNonce()%>&amp;action=Restart%20all"><%=intl._("Restart All")%></a> <a class="control" href="list?nonce=<%=indexBean.getNextNonce()%>&amp;action=Reload%20configuration"><%=intl._("Reload Config")%></a>
             </div>
         </div> 
     </div>
@@ -89,7 +89,7 @@
       %>
         <div class="nameField rowItem">
             <label><%=intl._("Name")%>:</label>
-            <span class="text"><a href="edit.jsp?tunnel=<%=curServer%>" title="Edit Server Tunnel Settings for <%=indexBean.getTunnelName(curServer)%>"><%=indexBean.getTunnelName(curServer)%></a></span>
+            <span class="text"><a href="edit?tunnel=<%=curServer%>" title="Edit Server Tunnel Settings for <%=indexBean.getTunnelName(curServer)%>"><%=indexBean.getTunnelName(curServer)%></a></span>
         </div>
         <div class="previewField rowItem">
             <label><%=intl._("Points at")%>:</label>
@@ -125,17 +125,17 @@
             switch (indexBean.getTunnelStatus(curServer)) {
                 case IndexBean.STARTING:
           %><div class="statusStarting text"><%=intl._("Starting...")%></div>    
-            <a class="control" title="Stop this Tunnel" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&amp;action=stop&amp;tunnel=<%=curServer%>"><%=intl._("Stop")%></a>
+            <a class="control" title="Stop this Tunnel" href="list?nonce=<%=indexBean.getNextNonce()%>&amp;action=stop&amp;tunnel=<%=curServer%>"><%=intl._("Stop")%></a>
         <%
                 break;
                 case IndexBean.RUNNING:
           %><div class="statusRunning text"><%=intl._("Running")%></div>    
-            <a class="control" title="Stop this Tunnel" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&amp;action=stop&amp;tunnel=<%=curServer%>"><%=intl._("Stop")%></a>
+            <a class="control" title="Stop this Tunnel" href="list?nonce=<%=indexBean.getNextNonce()%>&amp;action=stop&amp;tunnel=<%=curServer%>"><%=intl._("Stop")%></a>
         <%
                 break;
                 case IndexBean.NOT_RUNNING:
           %><div class="statusNotRunning text"><%=intl._("Stopped")%></div>    
-            <a class="control" title="Start this Tunnel" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&amp;action=start&amp;tunnel=<%=curServer%>"><%=intl._("Start")%></a>
+            <a class="control" title="Start this Tunnel" href="list?nonce=<%=indexBean.getNextNonce()%>&amp;action=start&amp;tunnel=<%=curServer%>"><%=intl._("Start")%></a>
         <%
                 break;
             }
@@ -157,7 +157,7 @@
         </div>
            
         <div class="footer">
-            <form id="addNewServerTunnelForm" action="edit.jsp"> 
+            <form id="addNewServerTunnelForm" action="edit"> 
             <div class="toolbox">
                     
         <label><%=intl._("New server tunnel")%>:</label>
@@ -209,7 +209,7 @@
       %>
         <div class="nameField rowItem">
             <label><%=intl._("Name")%>:</label>
-            <span class="text"><a href="edit.jsp?tunnel=<%=curClient%>" title="Edit Tunnel Settings for <%=indexBean.getTunnelName(curClient)%>"><%=indexBean.getTunnelName(curClient)%></a></span>
+            <span class="text"><a href="edit?tunnel=<%=curClient%>" title="Edit Tunnel Settings for <%=indexBean.getTunnelName(curClient)%>"><%=indexBean.getTunnelName(curClient)%></a></span>
         </div>
         <div class="portField rowItem">
             <label><%=intl._("Port")%>:</label>
@@ -229,22 +229,22 @@
             switch (indexBean.getTunnelStatus(curClient)) {
                 case IndexBean.STARTING:
           %><div class="statusStarting text"><%=intl._("Starting...")%></div>
-            <a class="control" title="Stop this Tunnel" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&amp;action=stop&amp;tunnel=<%=curClient%>"><%=intl._("Stop")%></a>
+            <a class="control" title="Stop this Tunnel" href="list?nonce=<%=indexBean.getNextNonce()%>&amp;action=stop&amp;tunnel=<%=curClient%>"><%=intl._("Stop")%></a>
         <%
                 break;
                 case IndexBean.STANDBY:
           %><div class="statusStarting text"><%=intl._("Standby")%></div>
-            <a class="control" title="Stop this Tunnel" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&amp;action=stop&amp;tunnel=<%=curClient%>"><%=intl._("Stop")%></a>
+            <a class="control" title="Stop this Tunnel" href="list?nonce=<%=indexBean.getNextNonce()%>&amp;action=stop&amp;tunnel=<%=curClient%>"><%=intl._("Stop")%></a>
         <%
                 break;
                 case IndexBean.RUNNING:
           %><div class="statusRunning text"><%=intl._("Running")%></div>
-            <a class="control" title="Stop this Tunnel" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&amp;action=stop&amp;tunnel=<%=curClient%>"><%=intl._("Stop")%></a>
+            <a class="control" title="Stop this Tunnel" href="list?nonce=<%=indexBean.getNextNonce()%>&amp;action=stop&amp;tunnel=<%=curClient%>"><%=intl._("Stop")%></a>
         <%
                 break;
                 case IndexBean.NOT_RUNNING:
           %><div class="statusNotRunning text"><%=intl._("Stopped")%></div>
-            <a class="control" title="Start this Tunnel" href="index.jsp?nonce=<%=indexBean.getNextNonce()%>&amp;action=start&amp;tunnel=<%=curClient%>"><%=intl._("Start")%></a>
+            <a class="control" title="Start this Tunnel" href="list?nonce=<%=indexBean.getNextNonce()%>&amp;action=start&amp;tunnel=<%=curClient%>"><%=intl._("Start")%></a>
         <%
                 break;
             }
@@ -285,7 +285,7 @@
         </div>
     
         <div class="footer">
-            <form id="addNewClientTunnelForm" action="edit.jsp">
+            <form id="addNewClientTunnelForm" action="edit">
                 <div class="toolbox">
                     
         <label><%=intl._("New client tunnel")%>:</label>
diff --git a/apps/i2ptunnel/jsp/web.xml b/apps/i2ptunnel/jsp/web.xml
index a814e9a87b..d333d29367 100644
--- a/apps/i2ptunnel/jsp/web.xml
+++ b/apps/i2ptunnel/jsp/web.xml
@@ -5,6 +5,19 @@
 
 <web-app>
     <!-- precompiled servlets -->
+
+    <!-- yeah we could do this in a handler but this is easier -->
+    <servlet-mapping>
+        <servlet-name>net.i2p.i2ptunnel.jsp.index_jsp</servlet-name>
+        <!-- this becomes the default so it also covers /index and /index.html -->
+        <url-pattern>/</url-pattern>
+    </servlet-mapping>
+
+    <servlet-mapping>
+        <servlet-name>net.i2p.i2ptunnel.jsp.edit_jsp</servlet-name>
+        <url-pattern>/edit</url-pattern>
+    </servlet-mapping>
+
     <session-config>
         <session-timeout>
             30
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java
index ffd2118109..5fc2000c5a 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java
@@ -143,7 +143,7 @@ public class SummaryBarRenderer {
                .append(_("Stats"))
                .append("</a>\n" +
 
-                        "<a href=\"/i2ptunnel/index.jsp\" target=\"_blank\" title=\"")
+                        "<a href=\"/i2ptunnel/\" target=\"_blank\" title=\"")
                .append(_("Local Destinations"))
                .append("\">")
                .append(_("I2PTunnel"))
diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java
index fe41f7f278..c6b9a593a5 100644
--- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java
+++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryHelper.java
@@ -362,7 +362,7 @@ public class SummaryHelper extends HelperBase {
         List<Destination> clients = new ArrayList(_context.clientManager().listClients());
         
         StringBuilder buf = new StringBuilder(512);
-        buf.append("<h3><a href=\"/i2ptunnel/index.jsp\" target=\"_blank\" title=\"").append(_("Add/remove/edit &amp; control your client and server tunnels")).append("\">").append(_("Local Destinations")).append("</a></h3><hr><div class=\"tunnels\">");
+        buf.append("<h3><a href=\"/i2ptunnel/\" target=\"_blank\" title=\"").append(_("Add/remove/edit &amp; control your client and server tunnels")).append("\">").append(_("Local Destinations")).append("</a></h3><hr><div class=\"tunnels\">");
         if (!clients.isEmpty()) {
             Collections.sort(clients, new AlphaComparator());
             buf.append("<table>");
diff --git a/apps/routerconsole/jsp/configkeyring.jsp b/apps/routerconsole/jsp/configkeyring.jsp
index 01c332b495..84cd543845 100644
--- a/apps/routerconsole/jsp/configkeyring.jsp
+++ b/apps/routerconsole/jsp/configkeyring.jsp
@@ -32,7 +32,7 @@
  <input type="hidden" name="nonce" value="<%=System.getProperty("net.i2p.router.web.ConfigKeyringHandler.nonce")%>" >
  <h3><%=intl._("Manual Keyring Addition")%></h3><p>
  <%=intl._("Enter keys for encrypted remote destinations here.")%>
- <%=intl._("Keys for local destinations must be entered on the")%> <a href="i2ptunnel/index.jsp"><%=intl._("I2PTunnel page")%></a>.
+ <%=intl._("Keys for local destinations must be entered on the")%> <a href="i2ptunnel/"><%=intl._("I2PTunnel page")%></a>.
 </p>
   <div class="wideload">
       <p><table><tr>
-- 
GitLab