bye .jsp part 2

This commit is contained in:
zzz
2010-11-17 22:26:31 +00:00
parent 8a385ffc32
commit 138be42aa5
14 changed files with 56 additions and 43 deletions

View File

@@ -22,7 +22,7 @@ public class ConfigNavHelper extends HelperBase {
public void renderNavBar(String requestURI) throws IOException {
StringBuilder buf = new StringBuilder(1024);
for (int i = 0; i < pages.length; i++) {
String page = "config" + pages[i] + ".jsp";
String page = "config" + pages[i];
if (requestURI.indexOf(page) != -1) {
// we are there
buf.append(_(titles[i]));

View File

@@ -20,7 +20,7 @@ public class ConfigPeerHandler extends FormHandler {
} else if (_action.equals(_("Ban peer until restart"))) {
Hash h = getHash();
if (h != null) {
_context.shitlist().shitlistRouterForever(h, _("Manually banned via {0}"), "<a href=\"configpeer.jsp\">configpeer.jsp</a>");
_context.shitlist().shitlistRouterForever(h, _("Manually banned via {0}"), "<a href=\"configpeer\">configpeer</a>");
addFormNotice(_("Peer") + " " + _peer + " " + _("banned until restart") );
return;
}

View File

@@ -29,7 +29,7 @@ public class ConfigUIHandler extends FormHandler {
if (_context.router().saveConfig()) {
if (!oldTheme.equals(_config))
addFormNotice(_("Theme change saved.") +
" <a href=\"configui.jsp\">" +
" <a href=\"configui\">" +
_("Refresh the page to view.") +
"</a>");
} else {

View File

@@ -127,8 +127,8 @@ public class GraphHelper extends HelperBase {
public String getForm() {
saveSettings();
try {
_out.write("<br><h3>" + _("Configure Graph Display") + " [<a href=\"configstats.jsp\">" + _("Select Stats") + "</a>]</h3>");
_out.write("<form action=\"graphs.jsp\" method=\"GET\">");
_out.write("<br><h3>" + _("Configure Graph Display") + " [<a href=\"configstats\">" + _("Select Stats") + "</a>]</h3>");
_out.write("<form action=\"graphs\" method=\"GET\">");
_out.write(_("Periods") + ": <input size=\"3\" type=\"text\" name=\"periodCount\" value=\"" + _periodCount + "\"><br>\n");
_out.write(_("Plot averages") + ": <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"false\" " + (_showEvents ? "" : "checked=\"true\" ") + "> ");
_out.write(_("or")+ " " +_("plot events") + ": <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"true\" "+ (_showEvents ? "checked=\"true\" " : "") + "><br>\n");

View File

@@ -13,7 +13,9 @@ import org.mortbay.jetty.servlet.WebApplicationHandler;
/**
* Convert foo.jsp to foo_xx.jsp for language xx.
* This is appropriate for jsps with large amounts of text.
* This does not work for included jsps (e.g. summary*)
*
* Also, as of 0.8.2, rewrite "/" and "/index.html" to "/index.jsp",x
* and "/foo" to "/foo.jsp".
*
* @author zzz
*/
@@ -46,9 +48,22 @@ public class LocaleWebAppHandler extends WebApplicationHandler
return;
}
// transparent rewriting
if (pathInContext.equals("/") || pathInContext.equals("/index.html")) {
// home page
pathInContext = "/index.jsp";
} else if (pathInContext.indexOf("/", 1) < 0 &&
!pathInContext.endsWith(".jsp")) {
// add .jsp to pages at top level
pathInContext += ".jsp";
}
//System.err.println("Path: " + pathInContext);
String newPath = pathInContext;
if (pathInContext.endsWith(".jsp")) {
//if (pathInContext.endsWith(".jsp")) {
// We only ended up doing this for help.jsp, so save some effort
// unless we translate more pages like this
if (pathInContext.equals("/help.jsp")) {
int len = pathInContext.length();
// ...but leave foo_xx.jsp alone
if (len < 8 || pathInContext.charAt(len - 7) != '_') {

View File

@@ -105,7 +105,7 @@ public class NetDbRenderer {
public void renderLeaseSetHTML(Writer out, boolean debug) throws IOException {
StringBuilder buf = new StringBuilder(4*1024);
buf.append("<h2>" + _("Network Database Contents") + "</h2>\n");
buf.append("<a href=\"netdb.jsp\">" + _("View RouterInfo") + "</a>");
buf.append("<a href=\"netdb\">" + _("View RouterInfo") + "</a>");
buf.append("<h3>").append(_("LeaseSets")).append("</h3>\n");
Hash ourRKey;
Set<LeaseSet> leases;
@@ -130,7 +130,7 @@ public class NetDbRenderer {
Hash key = dest.calculateHash();
buf.append("<b>").append(_("LeaseSet")).append(": ").append(key.toBase64());
if (_context.clientManager().isLocal(dest)) {
buf.append(" (<a href=\"tunnels.jsp#" + key.toBase64().substring(0,4) + "\">" + _("Local") + "</a> ");
buf.append(" (<a href=\"tunnels#" + key.toBase64().substring(0,4) + "\">" + _("Local") + "</a> ");
if (! _context.clientManager().shouldPublishLeaseSet(key))
buf.append(_("Unpublished") + ' ');
buf.append(_("Destination") + ' ');
@@ -212,7 +212,7 @@ public class NetDbRenderer {
* @param mode 0: our info and charts only; 1: full routerinfos and charts; 2: abbreviated routerinfos and charts
*/
public void renderStatusHTML(Writer out, int mode) throws IOException {
out.write("<h2>" + _("Network Database Contents") + " (<a href=\"netdb.jsp?l=1\">" + _("View LeaseSets") + "</a>)</h2>\n");
out.write("<h2>" + _("Network Database Contents") + " (<a href=\"netdb?l=1\">" + _("View LeaseSets") + "</a>)</h2>\n");
if (!_context.netDb().isInitialized()) {
out.write(_("Not initialized"));
out.flush();
@@ -223,7 +223,7 @@ public class NetDbRenderer {
boolean shortStats = mode == 2;
boolean showStats = full || shortStats;
Hash us = _context.routerHash();
out.write("<a name=\"routers\" ></a><h3>" + _("Routers") + " (<a href=\"netdb.jsp");
out.write("<a name=\"routers\" ></a><h3>" + _("Routers") + " (<a href=\"netdb");
if (full || !showStats)
out.write("?f=2#routers\" >" + _("Show all routers"));
else
@@ -343,9 +343,9 @@ public class NetDbRenderer {
} else {
buf.append("<b>" + _("Peer info for") + ":</b> ").append(hash).append("\n");
if (full) {
buf.append("[<a href=\"netdb.jsp\" >Back</a>]</th></tr><td>\n");
buf.append("[<a href=\"netdb\" >Back</a>]</th></tr><td>\n");
} else {
buf.append("[<a href=\"netdb.jsp?r=").append(hash.substring(0, 6)).append("\" >").append(_("Full entry")).append("</a>]</th></tr><td>\n");
buf.append("[<a href=\"netdb?r=").append(hash.substring(0, 6)).append("\" >").append(_("Full entry")).append("</a>]</th></tr><td>\n");
}
}

View File

@@ -74,7 +74,7 @@ class ProfileOrganizerRenderer {
if (older > 0)
buf.append(_("Hiding {0} older profiles.", older)).append('\n');
if (standard > 0)
buf.append("<a href=\"/profiles.jsp?f=1\">").append(_("Hiding {0} standard profiles.", standard)).append("</a>\n");
buf.append("<a href=\"/profiles?f=1\">").append(_("Hiding {0} standard profiles.", standard)).append("</a>\n");
buf.append("</p>");
buf.append("<table>");
buf.append("<tr>");
@@ -173,7 +173,7 @@ class ProfileOrganizerRenderer {
buf.append("&nbsp;</td>");
buf.append("<td nowrap align=\"center\"><a target=\"_blank\" href=\"dumpprofile.jsp?peer=")
.append(peer.toBase64().substring(0,6)).append("\">").append(_("profile")).append("</a>");
buf.append("&nbsp;<a href=\"configpeer.jsp?peer=").append(peer.toBase64()).append("\">+-</a></td>\n");
buf.append("&nbsp;<a href=\"configpeer?peer=").append(peer.toBase64()).append("\">+-</a></td>\n");
buf.append("</tr>");
// let's not build the whole page in memory (~500 bytes per peer)
out.write(buf.toString());

View File

@@ -67,7 +67,7 @@ public class ShitlistRenderer {
else
buf.append(_(entry.cause));
}
buf.append(" (<a href=\"configpeer.jsp?peer=").append(key.toBase64())
buf.append(" (<a href=\"configpeer?peer=").append(key.toBase64())
.append("#unsh\">").append(_("unban now")).append("</a>)");
buf.append("</li>\n");
}

View File

@@ -30,7 +30,7 @@ public class StatsGenerator {
public void generateStatsPage(Writer out, boolean showAll) throws IOException {
StringBuilder buf = new StringBuilder(16*1024);
buf.append("<div class=\"joblog\"><form action=\"/stats.jsp\">");
buf.append("<div class=\"joblog\"><form action=\"/stats\">");
buf.append("<select name=\"go\" onChange='location.href=this.value'>");
out.write(buf.toString());
buf.setLength(0);
@@ -39,7 +39,7 @@ public class StatsGenerator {
for (Iterator iter = groups.entrySet().iterator(); iter.hasNext(); ) {
Map.Entry entry = (Map.Entry)iter.next();
String group = (String)entry.getKey();
buf.append("<option value=\"/stats.jsp#").append(group).append("\">");
buf.append("<option value=\"#").append(group).append("\">");
buf.append(_(group)).append("</option>\n");
// let's just do the groups
//Set stats = (Set)entry.getValue();

View File

@@ -28,7 +28,7 @@ public class SummaryBarRenderer {
StringBuilder buf = new StringBuilder(8*1024);
String theme = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
buf.append("<a href=\"/index.jsp\" target=\"_top\"><img src=\"")
buf.append("<a href=\"/\" target=\"_top\"><img src=\"")
.append(CSSHelper.BASE_THEME_PATH)
.append(theme)
.append("/images/i2plogo.png\" alt=\"")
@@ -37,7 +37,7 @@ public class SummaryBarRenderer {
.append(_("I2P Router Console"))
.append("\"></a><hr>")
.append("<h3><a href=\"/help.jsp\" target=\"_top\" title=\"")
.append("<h3><a href=\"/help\" target=\"_top\" title=\"")
.append(_("I2P Router Help &amp; FAQ"))
.append("\">")
.append(_("Help &amp; FAQ"))
@@ -51,7 +51,7 @@ public class SummaryBarRenderer {
linkhelper.setMaxLines("100");
buf.append(linkhelper.getContent());
} else {
buf.append("<h3><a href=\"/configclients.jsp\" target=\"_top\" title=\"")
buf.append("<h3><a href=\"/configclients\" target=\"_top\" title=\"")
.append(_("Configure startup of clients and webapps (services); manually start dormant services"))
.append("\">")
.append(_("I2P Services"))
@@ -87,7 +87,7 @@ public class SummaryBarRenderer {
.append("</td></tr></table>\n" +
"<hr><h3><a href=\"/config.jsp\" target=\"_top\" title=\"")
"<hr><h3><a href=\"/config\" target=\"_top\" title=\"")
.append(_("Configure I2P Router"))
.append("\">")
.append(_("I2P Internals"))
@@ -95,31 +95,31 @@ public class SummaryBarRenderer {
"<table><tr><td>\n" +
"<a href=\"/tunnels.jsp\" target=\"_top\" title=\"")
"<a href=\"/tunnels\" target=\"_top\" title=\"")
.append(_("View existing tunnels and tunnel build status"))
.append("\">")
.append(_("Tunnels"))
.append("</a>\n" +
"<a href=\"/peers.jsp\" target=\"_top\" title=\"")
"<a href=\"/peers\" target=\"_top\" title=\"")
.append(_("Show all current peer connections"))
.append("\">")
.append(_("Peers"))
.append("</a>\n" +
"<a href=\"/profiles.jsp\" target=\"_top\" title=\"")
"<a href=\"/profiles\" target=\"_top\" title=\"")
.append(_("Show recent peer performance profiles"))
.append("\">")
.append(_("Profiles"))
.append("</a>\n" +
"<a href=\"/netdb.jsp\" target=\"_top\" title=\"")
"<a href=\"/netdb\" target=\"_top\" title=\"")
.append(_("Show list of all known I2P routers"))
.append("\">")
.append(_("NetDB"))
.append("</a>\n" +
"<a href=\"/logs.jsp\" target=\"_top\" title=\"")
"<a href=\"/logs\" target=\"_top\" title=\"")
.append(_("Health Report"))
.append("\">")
.append(_("Logs"))
@@ -131,13 +131,13 @@ public class SummaryBarRenderer {
// .append(_("Jobs"))
// .append("</a>\n" +
"<a href=\"/graphs.jsp\" target=\"_top\" title=\"")
"<a href=\"/graphs\" target=\"_top\" title=\"")
.append(_("Graph router performance"))
.append("\">")
.append(_("Graphs"))
.append("</a>\n" +
"<a href=\"/stats.jsp\" target=\"_top\" title=\"")
"<a href=\"/stats\" target=\"_top\" title=\"")
.append(_("Textual router performance statistics"))
.append("\">")
.append(_("Stats"))
@@ -156,7 +156,7 @@ public class SummaryBarRenderer {
buf.append("<hr><h3><a href=\"/help.jsp\" target=\"_top\" title=\"")
buf.append("<hr><h3><a href=\"/help\" target=\"_top\" title=\"")
.append(_("I2P Router Help"))
.append("\">")
.append(_("General"))
@@ -173,7 +173,7 @@ public class SummaryBarRenderer {
.append(_helper.getIdent())
.append(", ")
.append(_("never reveal it to anyone"))
.append("\" href=\"/netdb.jsp?r=.\" target=\"_top\">")
.append("\" href=\"/netdb?r=.\" target=\"_top\">")
.append(_("show"))
.append("</a></td></tr>\n" +
@@ -194,7 +194,7 @@ public class SummaryBarRenderer {
.append(_helper.getUptime())
.append("</td></tr></table>\n" +
"<hr><h4><a href=\"/config.jsp#help\" target=\"_top\" title=\"")
"<hr><h4><a href=\"/config#help\" target=\"_top\" title=\"")
.append(_("Help with configuring your firewall and router for optimal I2P performance"))
.append("\">")
.append(_("Network"))
@@ -250,7 +250,7 @@ public class SummaryBarRenderer {
buf.append("<p>")
.append(ConfigRestartBean.renderStatus(_helper.getRequestURI(), _helper.getAction(), _helper.getConsoleNonce()))
.append("</p><hr><h3><a href=\"/peers.jsp\" target=\"_top\" title=\"")
.append("</p><hr><h3><a href=\"/peers\" target=\"_top\" title=\"")
.append(_("Show all current peer connections"))
.append("\">")
.append(_("Peers"))
@@ -299,7 +299,7 @@ public class SummaryBarRenderer {
boolean anotherLine = false;
if (_helper.showFirewallWarning()) {
buf.append("<h4><a href=\"/config.jsp\" target=\"_top\" title=\"")
buf.append("<h4><a href=\"/config\" target=\"_top\" title=\"")
.append(_("Help with firewall configuration"))
.append("\">")
.append(_("Check NAT/firewall"))
@@ -338,7 +338,7 @@ public class SummaryBarRenderer {
buf.append("<hr>");
buf.append("<h3><a href=\"/config.jsp\" title=\"")
buf.append("<h3><a href=\"/config\" title=\"")
.append(_("Configure router bandwidth allocation"))
.append("\" target=\"_top\">")
.append(_("Bandwidth in/out"))
@@ -375,7 +375,7 @@ public class SummaryBarRenderer {
.append(_helper.getOutboundTransferred())
.append("</td></tr></table>\n" +
"<hr><h3><a href=\"/tunnels.jsp\" target=\"_top\" title=\"")
"<hr><h3><a href=\"/tunnels\" target=\"_top\" title=\"")
.append(_("View existing tunnels and tunnel build status"))
.append("\">")
.append(_("Tunnels"))
@@ -406,7 +406,7 @@ public class SummaryBarRenderer {
.append(_helper.getShareRatio())
.append("</td></tr>\n" +
"</table><hr><h3><a href=\"/jobs.jsp\" target=\"_top\" title=\"")
"</table><hr><h3><a href=\"/jobs\" target=\"_top\" title=\"")
.append(_("What's in the router's job queue?"))
.append("\">")
.append(_("Congestion"))

View File

@@ -377,7 +377,7 @@ public class SummaryHelper extends HelperBase {
buf.append("server.png\" alt=\"Server\" title=\"" + _("Server") + "\">");
else
buf.append("client.png\" alt=\"Client\" title=\"" + _("Client") + "\">");
buf.append("</td><td align=\"left\"><b><a href=\"tunnels.jsp#").append(h.toBase64().substring(0,4));
buf.append("</td><td align=\"left\"><b><a href=\"tunnels#").append(h.toBase64().substring(0,4));
buf.append("\" target=\"_top\" title=\"" + _("Show tunnels") + "\">");
if (name.length() < 16)
buf.append(name);

View File

@@ -38,7 +38,7 @@ public class TunnelRenderer {
}
public void renderStatusHTML(Writer out) throws IOException {
out.write("<div class=\"wideload\"><h2><a name=\"exploratory\" ></a>" + _("Exploratory tunnels") + " (<a href=\"/configtunnels.jsp#exploratory\">" + _("configure") + "</a>)</h2>\n");
out.write("<div class=\"wideload\"><h2><a name=\"exploratory\" ></a>" + _("Exploratory tunnels") + " (<a href=\"/configtunnels#exploratory\">" + _("configure") + "</a>)</h2>\n");
renderPool(out, _context.tunnelManager().getInboundExploratoryPool(), _context.tunnelManager().getOutboundExploratoryPool());
List<Hash> destinations = null;
@@ -60,7 +60,7 @@ public class TunnelRenderer {
out.write("<h2><a name=\"" + client.toBase64().substring(0,4)
+ "\" ></a>" + _("Client tunnels for") + ' ' + _(name));
if (_context.clientManager().isLocal(client))
out.write(" (<a href=\"/configtunnels.jsp#" + client.toBase64().substring(0,4) +"\">" + _("configure") + "</a>)</h2>\n");
out.write(" (<a href=\"/configtunnels#" + client.toBase64().substring(0,4) +"\">" + _("configure") + "</a>)</h2>\n");
else
out.write(" (" + _("dead") + ")</h2>\n");
renderPool(out, in, outPool);

View File

@@ -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>

View File

@@ -34,7 +34,7 @@ clientApp.3.startOnLoad=true
# load a browser pointing at the web console whenever we start up
clientApp.4.main=net.i2p.apps.systray.UrlLauncher
clientApp.4.name=Open Router Console in web browser at startup
clientApp.4.args=http://127.0.0.1:7657/index.jsp
clientApp.4.args=http://127.0.0.1:7657/
clientApp.4.delay=3
clientApp.4.startOnLoad=true