* HarvesterJob: Don't instantiate if disabled

* NetDb: Add netDb.exploreKeySet stat
    * netdb.jsp: Add parameter ?r=xxxxxx to view a single routerinfo,
      and ?r=. to view our own; change links on other pages too
This commit is contained in:
zzz
2008-09-12 13:37:22 +00:00
parent cf54dd159d
commit 825af3e6c1
12 changed files with 64 additions and 12 deletions

View File

@ -10,6 +10,8 @@ import net.i2p.router.RouterContext;
public class NetDbHelper {
private RouterContext _context;
private Writer _out;
private String _routerPrefix;
/**
* Configure this bean to query a particular router context
*
@ -27,15 +29,22 @@ public class NetDbHelper {
public NetDbHelper() {}
public void setWriter(Writer writer) { _out = writer; }
public void setRouter(String r) { _routerPrefix = r; }
public String getNetDbSummary() {
try {
if (_out != null) {
_context.netDb().renderStatusHTML(_out);
if (_routerPrefix != null)
_context.netDb().renderRouterInfoHTML(_out, _routerPrefix);
else
_context.netDb().renderStatusHTML(_out);
return "";
} else {
ByteArrayOutputStream baos = new ByteArrayOutputStream(32*1024);
_context.netDb().renderStatusHTML(new OutputStreamWriter(baos));
if (_routerPrefix != null)
_context.netDb().renderRouterInfoHTML(new OutputStreamWriter(baos), _routerPrefix);
else
_context.netDb().renderStatusHTML(new OutputStreamWriter(baos));
return new String(baos.toByteArray());
}
} catch (IOException ioe) {

View File

@ -14,6 +14,7 @@
<jsp:useBean class="net.i2p.router.web.NetDbHelper" id="netdbHelper" scope="request" />
<jsp:setProperty name="netdbHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<jsp:setProperty name="netdbHelper" property="writer" value="<%=out%>" />
<jsp:setProperty name="netdbHelper" property="router" value="<%=request.getParameter("r")%>" />
<jsp:getProperty name="netdbHelper" property="netDbSummary" />
</div>

View File

@ -10,7 +10,7 @@
<div class="routersummary">
<u><b>General</b></u><br />
<b>Ident:</b> (<a title="Your router identity is <jsp:getProperty name="helper" property="ident" />, never reveal it to anyone" href="netdb.jsp#our-info">view</a>)<br />
<b>Ident:</b> (<a title="Your router identity is <jsp:getProperty name="helper" property="ident" />, never reveal it to anyone" href="netdb.jsp?r=.">view</a>)<br />
<b>Version:</b> <jsp:getProperty name="helper" property="version" /><br />
<b>Uptime:</b> <jsp:getProperty name="helper" property="uptime" /><br />
<b>Now:</b> <jsp:getProperty name="helper" property="time" /><br />