diff --git a/apps/routerconsole/jsp/debug.jsp b/apps/routerconsole/jsp/debug.jsp index dd1c46c69ef7fc4f2481e6c61b8aa43be9578923..3c154d88c0a5da72715872089fe9d6382918ccc4 100644 --- a/apps/routerconsole/jsp/debug.jsp +++ b/apps/routerconsole/jsp/debug.jsp @@ -38,6 +38,11 @@ */ ctx.routerAppManager().renderStatusHTML(out); + /* + * Print out the status for the PortMapper + */ + ctx.portMapper().renderStatusHTML(out); + /* * Print out the status for all the SessionKeyManagers */ diff --git a/core/java/src/net/i2p/util/PortMapper.java b/core/java/src/net/i2p/util/PortMapper.java index ff626961b17da6404aa6b7e364f9542be51a64a8..b3c8e65e775f289e63e9e233b904392c0cc5c32b 100644 --- a/core/java/src/net/i2p/util/PortMapper.java +++ b/core/java/src/net/i2p/util/PortMapper.java @@ -1,5 +1,10 @@ package net.i2p.util; +import java.io.IOException; +import java.io.Writer; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; import java.util.concurrent.ConcurrentHashMap; import net.i2p.I2PAppContext; @@ -73,4 +78,18 @@ public class PortMapper { return def; return port.intValue(); } + + /** + * For debugging only + * @since 0.9.20 + */ + public void renderStatusHTML(Writer out) throws IOException { + List<String> services = new ArrayList(_dir.keySet()); + out.write("<h2>Port Mapper</h2><table><tr><th>Service<th>Port\n"); + Collections.sort(services); + for (String s : services) { + out.write("<tr><td>" + s + "<td>" + _dir.get(s) + '\n'); + } + out.write("</table>\n"); + } }