use the new .jsp filenames (i'm not quite ready to drop support for this old admin console... yet)

This commit is contained in:
jrandom
2004-09-02 07:20:45 +00:00
committed by zzz
parent 8b2d27a916
commit 446d863106
3 changed files with 23 additions and 32 deletions

View File

@ -268,27 +268,21 @@ public class Router {
}
public void renderStatusHTML(OutputStream out) throws IOException {
out.write(("<html><head><title>I2P Router Console</title></head><body>\n" +
"<h1>Router console</h1>\n" +
"<i><a href=\"/routerConsole.html\">console</a> | <a href=\"/routerStats.html\">stats</a></i><br>\n" +
"<form action=\"/routerConsole.html\">" +
out.write(("<h1>Router console</h1>\n" +
"<i><a href=\"/oldconsole.jsp\">console</a> | <a href=\"/oldstats.jsp\">stats</a></i><br>\n" +
"<form action=\"/oldconsole.jsp\">" +
"<select name=\"go\" onChange='location.href=this.value'>" +
"<option value=\"/routerConsole.html#bandwidth\">Bandwidth</option>\n" +
"<option value=\"/routerConsole.html#clients\">Clients</option>\n" +
"<option value=\"/routerConsole.html#transports\">Transports</option>\n" +
"<option value=\"/routerConsole.html#profiles\">Peer Profiles</option>\n" +
"<option value=\"/routerConsole.html#tunnels\">Tunnels</option>\n" +
"<option value=\"/routerConsole.html#jobs\">Jobs</option>\n" +
"<option value=\"/routerConsole.html#shitlist\">Shitlist</option>\n" +
"<option value=\"/routerConsole.html#pending\">Pending messages</option>\n" +
"<option value=\"/routerConsole.html#netdb\">Network Database</option>\n" +
"<option value=\"/routerConsole.html#logs\">Log messages</option>\n" +
"</select>" +"</form>" +
"<form action=\"/shutdown\" method=\"GET\">" +
"<b>Shut down the router:</b>" +
"<input type=\"password\" name=\"password\" size=\"8\" />" +
"<input type=\"submit\" value=\"shutdown!\" />" +
"</form>" +
"<option value=\"/oldconsole.jsp#bandwidth\">Bandwidth</option>\n" +
"<option value=\"/oldconsole.jsp#clients\">Clients</option>\n" +
"<option value=\"/oldconsole.jsp#transports\">Transports</option>\n" +
"<option value=\"/oldconsole.jsp#profiles\">Peer Profiles</option>\n" +
"<option value=\"/oldconsole.jsp#tunnels\">Tunnels</option>\n" +
"<option value=\"/oldconsole.jsp#jobs\">Jobs</option>\n" +
"<option value=\"/oldconsole.jsp#shitlist\">Shitlist</option>\n" +
"<option value=\"/oldconsole.jsp#pending\">Pending messages</option>\n" +
"<option value=\"/oldconsole.jsp#netdb\">Network Database</option>\n" +
"<option value=\"/oldconsole.jsp#logs\">Log messages</option>\n" +
"</select> <input type=\"submit\" value=\"GO\" /> </form>" +
"<hr />\n").getBytes());
StringBuffer buf = new StringBuffer(32*1024);
@ -303,7 +297,7 @@ public class Router {
buf.append("<b>Memory:</b> In use: ").append((tot-free)).append("KB Free: ").append(free).append("KB <br />\n");
buf.append("<b>Version:</b> Router: ").append(RouterVersion.VERSION).append(" / SDK: ").append(CoreVersion.VERSION).append("<br />\n");
if (_higherVersionSeen)
buf.append("<b><font color=\"red\">HIGHER VERSION SEEN</font><b> - please <a href=\"http://i2p.dnsalias.net/\">check</a> to see if there is a new release out<br />\n");
buf.append("<b><font color=\"red\">HIGHER VERSION SEEN</font><b> - please <a href=\"http://www.i2p.net/\">check</a> to see if there is a new release out<br />\n");
buf.append("<hr /><a name=\"bandwidth\"> </a><h2>Bandwidth</h2>\n");
long sent = _context.bandwidthLimiter().getTotalAllocatedOutboundBytes();
@ -457,8 +451,7 @@ public class Router {
appendLogMessage(buf, msg);
buf.append("</pre></td></tr>\n");
}
buf.append("</table>");
buf.append("</body></html>\n");
buf.append("</table>\n");
out.write(buf.toString().getBytes());
}
@ -707,7 +700,7 @@ public class Router {
}
/** update the router.info file whenever its, er, updated */
private class PersistRouterInfoJob extends JobImpl {
private class PersistRouterInfoJob extends JobImpl {
public PersistRouterInfoJob() { super(Router.this._context); }
public String getName() { return "Persist Updated Router Information"; }
public void runJob() {

View File

@ -44,7 +44,7 @@ class AdminRunner implements Runnable {
_log.debug("Command [" + command + "]");
if (command.indexOf("favicon") >= 0) {
reply(out, "this is not a website");
} else if (command.indexOf("routerStats.html") >= 0) {
} else if ( (command.indexOf("routerStats.html") >= 0) || (command.indexOf("oldstats.jsp") >= 0) ) {
try {
out.write("HTTP/1.1 200 OK\nConnection: close\nCache-control: no-cache\nContent-type: text/html\n\n".getBytes());
_generator.generateStatsPage(out);

View File

@ -29,10 +29,9 @@ public class StatsGenerator {
public void generateStatsPage(OutputStream out) throws IOException {
StringBuffer buf = new StringBuffer(16*1024);
buf.append("<html><head><title>I2P Router Stats</title></head><body>");
buf.append("<h1>Router statistics</h1>");
buf.append("<i><a href=\"/routerConsole.html\">console</a> | <a href=\"/routerStats.html\">stats</a></i><hr />");
buf.append("<form action=\"/routerStats.html\">");
buf.append("<i><a href=\"/oldconsole.jsp\">console</a> | <a href=\"/oldstats.jsp\">stats</a></i><hr />");
buf.append("<form action=\"/oldstats.jsp\">");
buf.append("<select name=\"go\" onChange='location.href=this.value'>");
out.write(buf.toString().getBytes());
buf.setLength(0);
@ -41,11 +40,11 @@ public class StatsGenerator {
for (Iterator iter = groups.keySet().iterator(); iter.hasNext(); ) {
String group = (String)iter.next();
Set stats = (Set)groups.get(group);
buf.append("<option value=\"/routerStats.html#").append(group).append("\">");
buf.append("<option value=\"/oldstats.jsp#").append(group).append("\">");
buf.append(group).append("</option>\n");
for (Iterator statIter = stats.iterator(); statIter.hasNext(); ) {
String stat = (String)statIter.next();
buf.append("<option value=\"/routerStats.html#");
buf.append("<option value=\"/oldstats.jsp#");
buf.append(stat);
buf.append("\">...");
buf.append(stat);
@ -54,7 +53,7 @@ public class StatsGenerator {
out.write(buf.toString().getBytes());
buf.setLength(0);
}
buf.append("</select>");
buf.append("</select> <input type=\"submit\" value=\"GO\" />");
buf.append("</form>");
buf.append("Statistics gathered during this router's uptime (");
@ -92,7 +91,6 @@ public class StatsGenerator {
}
out.write("</ul><hr />".getBytes());
}
out.write("</body></html>".getBytes());
}
private void renderFrequency(String name, StringBuffer buf) {