Files
i2p.i2p/apps/routerconsole/jsp/index.jsp

35 lines
1.1 KiB
Plaintext
Raw Normal View History

<%
/*
* USE CAUTION WHEN EDITING
* Trailing whitespace OR NEWLINE on the last line will cause
* IllegalStateExceptions !!!
*
* Do not tag this file for translation.
*/
2012-02-20 14:32:48 +00:00
//
// Redirect to either /home or /console, depending on configuration,
// while preserving any query parameters
//
response.setStatus(307);
2012-02-20 14:32:48 +00:00
String req = request.getRequestURL().toString();
StringBuilder buf = new StringBuilder(128);
if (req.endsWith("index"))
req = req.substring(0, req.length() - 5);
else if (req.endsWith("index.jsp"))
req = req.substring(0, req.length() - 9);
2012-02-20 14:32:48 +00:00
buf.append(req);
if (!req.endsWith("/"))
2012-02-20 14:32:48 +00:00
buf.append('/');
boolean oldHome = net.i2p.I2PAppContext.getGlobalContext().getBooleanProperty("routerconsole.oldHomePage");
if (oldHome)
2012-02-20 14:32:48 +00:00
buf.append("console");
else
2012-02-20 14:32:48 +00:00
buf.append("home");
String query = request.getQueryString();
if (query != null)
buf.append('?').append(query);
response.setHeader("Location", buf.toString());
// force commitment
response.getOutputStream().close();
%>