diff --git a/router/java/src/net/i2p/router/peermanager/ProfileOrganizerRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java similarity index 98% rename from router/java/src/net/i2p/router/peermanager/ProfileOrganizerRenderer.java rename to apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java index e75db83b4baee93f298f8d5bb141770a41e205b2..f0f44c4c19f35b1113968681043a15b3dd464bdc 100644 --- a/router/java/src/net/i2p/router/peermanager/ProfileOrganizerRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ProfileOrganizerRenderer.java @@ -1,4 +1,4 @@ -package net.i2p.router.peermanager; +package net.i2p.router.web; import java.io.IOException; import java.io.Writer; @@ -12,6 +12,9 @@ import net.i2p.data.DataHelper; import net.i2p.data.Hash; import net.i2p.data.RouterInfo; import net.i2p.router.RouterContext; +import net.i2p.router.peermanager.DBHistory; +import net.i2p.router.peermanager.PeerProfile; +import net.i2p.router.peermanager.ProfileOrganizer; import net.i2p.stat.Rate; import net.i2p.stat.RateStat; diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ProfilesHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ProfilesHelper.java index ce2242aa7156e7e014eecccd232437546ccdfb8d..3b02f6b30a9a987dcd0c1a0a6d69d90c06d8910b 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ProfilesHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ProfilesHelper.java @@ -1,30 +1,29 @@ package net.i2p.router.web; -import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.OutputStreamWriter; public class ProfilesHelper extends HelperBase { public ProfilesHelper() {} + /** @return empty string, writes directly to _out */ public String getProfileSummary() { - ByteArrayOutputStream baos = new ByteArrayOutputStream(16*1024); try { - _context.profileOrganizer().renderStatusHTML(new OutputStreamWriter(baos)); + ProfileOrganizerRenderer rend = new ProfileOrganizerRenderer(_context.profileOrganizer(), _context); + rend.renderStatusHTML(_out); } catch (IOException ioe) { ioe.printStackTrace(); } - return new String(baos.toByteArray()); + return ""; } + /** @return empty string, writes directly to _out */ public String getShitlistSummary() { - ByteArrayOutputStream baos = new ByteArrayOutputStream(4*1024); try { - _context.shitlist().renderStatusHTML(new OutputStreamWriter(baos)); + _context.shitlist().renderStatusHTML(_out); } catch (IOException ioe) { ioe.printStackTrace(); } - return new String(baos.toByteArray()); + return ""; } } diff --git a/apps/routerconsole/jsp/configpeer.jsp b/apps/routerconsole/jsp/configpeer.jsp index 007452229d137303c803bbd119712ec882a5aa1a..b58d86fe18b0b68c6d0835958dc9107846e0bb60 100644 --- a/apps/routerconsole/jsp/configpeer.jsp +++ b/apps/routerconsole/jsp/configpeer.jsp @@ -71,6 +71,7 @@ <a name="shitlist"> </a> <jsp:useBean class="net.i2p.router.web.ProfilesHelper" id="profilesHelper" scope="request" /> <jsp:setProperty name="profilesHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> + <jsp:setProperty name="profilesHelper" property="writer" value="<%=out%>" /> <jsp:getProperty name="profilesHelper" property="shitlistSummary" /> <hr> <div class="wideload"> diff --git a/apps/routerconsole/jsp/profiles.jsp b/apps/routerconsole/jsp/profiles.jsp index 2ae4ff6b2689c0c7af1484c9fbf313e635649e3e..6eae2642fd08f1f8a3176ec4395629db4c000226 100644 --- a/apps/routerconsole/jsp/profiles.jsp +++ b/apps/routerconsole/jsp/profiles.jsp @@ -9,6 +9,7 @@ <div class="main" id="main"><div class="wideload"> <jsp:useBean class="net.i2p.router.web.ProfilesHelper" id="profilesHelper" scope="request" /> <jsp:setProperty name="profilesHelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" /> + <jsp:setProperty name="profilesHelper" property="writer" value="<%=out%>" /> <jsp:getProperty name="profilesHelper" property="profileSummary" /> <br> <a name="shitlist"> </a> diff --git a/router/java/src/net/i2p/router/peermanager/PeerManager.java b/router/java/src/net/i2p/router/peermanager/PeerManager.java index 41110c3069a6d07052910a9e83d2f583a961c054..009a6ed5064e352e77277b96a59bdc9764b425fd 100644 --- a/router/java/src/net/i2p/router/peermanager/PeerManager.java +++ b/router/java/src/net/i2p/router/peermanager/PeerManager.java @@ -250,8 +250,4 @@ class PeerManager { return rv; } } - - public void renderStatusHTML(Writer out) throws IOException { - _organizer.renderStatusHTML(out); - } } diff --git a/router/java/src/net/i2p/router/peermanager/PeerManagerFacadeImpl.java b/router/java/src/net/i2p/router/peermanager/PeerManagerFacadeImpl.java index 3483873a5ab3d7e3e37a37ec75682725a93af320..14ee5317e2a8b56b8dcffd953246197c6a8c23b8 100644 --- a/router/java/src/net/i2p/router/peermanager/PeerManagerFacadeImpl.java +++ b/router/java/src/net/i2p/router/peermanager/PeerManagerFacadeImpl.java @@ -78,8 +78,8 @@ public class PeerManagerFacadeImpl implements PeerManagerFacade { return _manager.getPeersByCapability(capability); } + /** @deprecated, moved to routerconsole */ public void renderStatusHTML(Writer out) throws IOException { - _manager.renderStatusHTML(out); } } diff --git a/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java b/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java index 07d25fce854e53f8656d01addae3b4def5e31610..4fd812efa99075c121850e1caee5ea3dc7821e02 100644 --- a/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java +++ b/router/java/src/net/i2p/router/peermanager/ProfileOrganizer.java @@ -139,7 +139,7 @@ public class ProfileOrganizer { } public void setUs(Hash us) { _us = us; } - Hash getUs() { return _us; } + public Hash getUs() { return _us; } public double getSpeedThreshold() { return _thresholdSpeedValue; } public double getCapacityThreshold() { return _thresholdCapacityValue; } @@ -258,11 +258,6 @@ public class ProfileOrganizer { _persistenceHelper.writeProfile(prof, out); } - public void renderStatusHTML(Writer out) throws IOException { - ProfileOrganizerRenderer rend = new ProfileOrganizerRenderer(this, _context); - rend.renderStatusHTML(out); - } - /** * Return a set of Hashes for peers that are both fast and reliable. If an insufficient * number of peers are both fast and reliable, fall back onto high capacity peers, and if that