I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit ca70fc8d authored by jrandom's avatar jrandom Committed by zzz
Browse files

load the body of the index.jsp from ./readme.html (so we can put in some intro...

load the body of the index.jsp from ./readme.html (so we can put in some intro crap w/ links and the user can change it later)
parent 18ff889b
No related branches found
No related tags found
No related merge requests found
package net.i2p.router.web;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.List;
import net.i2p.data.DataHelper;
import net.i2p.router.RouterContext;
public class ContentHelper {
private String _page;
private int _maxLines;
private RouterContext _context;
/**
* Configure this bean to query a particular router context
*
* @param contextId begging few characters of the routerHash, or null to pick
* the first one we come across.
*/
public void setContextId(String contextId) {
try {
_context = ContextHelper.getContext(contextId);
} catch (Throwable t) {
t.printStackTrace();
}
}
public ContentHelper() {}
public void setPage(String page) { _page = page; }
public void setMaxLines(String lines) {
if (lines != null) {
try {
_maxLines = Integer.parseInt(lines);
} catch (NumberFormatException nfe) {
_maxLines = -1;
}
} else {
_maxLines = -1;
}
}
public String getContent() {
String str = DataHelper.readTextFile(_page, _maxLines);
if (str == null)
return "";
else
return str;
}
public String getTextContent() {
String str = DataHelper.readTextFile(_page, _maxLines);
if (str == null)
return "";
else
return "<pre>" + str + "</pre>";
}
}
...@@ -11,7 +11,10 @@ ...@@ -11,7 +11,10 @@
<%@include file="summary.jsp" %> <%@include file="summary.jsp" %>
<div class="main" id="main"> <div class="main" id="main">
<h2>Welcome to your router console</h2> <jsp:useBean class="net.i2p.router.web.ContentHelper" id="contenthelper" scope="request" />
<jsp:setProperty name="contenthelper" property="page" value="readme.html" />
<jsp:setProperty name="contenthelper" property="maxLines" value="300" />
<jsp:getProperty name="contenthelper" property="content" />
</div> </div>
</body> </body>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment