merge of 'a0b025f180c1f7befcc1eb504c24140cf9e3fc0f'

and 'e0773d79a9bc8820024206f39686541ddb393c4a'
This commit is contained in:
dg2-new
2015-06-29 20:22:10 +00:00
19 changed files with 155 additions and 71 deletions

View File

@@ -1,5 +1,5 @@
Apache Tomcat
Copyright 1999-2014 The Apache Software Foundation
Copyright 1999-2015 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).

View File

@@ -2,7 +2,7 @@ This is Apache Tomcat 6.x, supporting Servlet 2.5 and JSP 2.1.
The Glassfish JSP 2.1 bundled in Jetty 6 is way too old.
Retrieved from the file
apache-tomcat-6.0.43-deployer.tar.gz
apache-tomcat-6.0.44-deployer.tar.gz
minus the following files and directores:

View File

@@ -1,7 +1,7 @@
This is Apache Tomcat 6.x, supporting Servlet 2.5 and JSP 2.1.
Retrieved from the file
apache-tomcat-6.0.43.tar.gz
apache-tomcat-6.0.44.tar.gz
containing only a small subset of lib/tomcat-coyote.jar.

View File

@@ -10,7 +10,7 @@
<property name="javac.compilerargs" value="" />
<property name="javac.version" value="1.6" />
<property name="tomcat.lib" value="apache-tomcat-deployer/lib" />
<property name="tomcat.ver" value="6.0.43" />
<property name="tomcat.ver" value="6.0.44" />
<property name="tomcat2.lib" value="apache-tomcat-${tomcat.ver}/lib" />
<property name="tomcat2.lib.small" value="apache-tomcat/lib" />

View File

@@ -16,6 +16,7 @@ package net.i2p.jetty;
// limitations under the License.
// ========================================================================
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -25,8 +26,10 @@ import java.util.Properties;
import net.i2p.I2PAppContext;
import net.i2p.app.*;
import static net.i2p.app.ClientAppState.*;
import net.i2p.util.PortMapper;
import java.io.InputStream;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.xml.XmlConfiguration;
@@ -45,13 +48,15 @@ public class JettyStart implements ClientApp {
private final ClientAppManager _mgr;
private final String[] _args;
private final List<LifeCycle> _jettys;
private final I2PAppContext _context;
private volatile ClientAppState _state;
private volatile int _port;
/**
* All args must be XML file names.
* Does not support any of the other argument types from org.mortbay.start.Main.
*
* @param context unused, may be null
* @param context may be null
* @param mgr may be null e.g. for use in plugins
*/
public JettyStart(I2PAppContext context, ClientAppManager mgr, String[] args) throws Exception {
@@ -59,6 +64,7 @@ public class JettyStart implements ClientApp {
_mgr = mgr;
_args = args;
_jettys = new ArrayList<LifeCycle>(args.length);
_context = context;
parseArgs(args);
_state = INITIALIZED;
}
@@ -116,6 +122,22 @@ public class JettyStart implements ClientApp {
if (!lc.isRunning()) {
try {
lc.start();
if (_context != null && _context.portMapper().getPort(PortMapper.SVC_EEPSITE) <= 0) {
if (lc instanceof Server) {
Server server = (Server) lc;
Connector[] connectors = server.getConnectors();
if (connectors.length > 0) {
int port = connectors[0].getPort();
if (port > 0) {
_port = port;
String host = connectors[0].getHost();
if (host.equals("0.0.0.0") || host.equals("::"))
host = "127.0.0.1";
_context.portMapper().register(PortMapper.SVC_EEPSITE, host, port);
}
}
}
}
} catch (Exception e) {
changeState(START_FAILED, e);
return;
@@ -154,6 +176,10 @@ public class JettyStart implements ClientApp {
}
}
}
if (_context != null && _port > 0 && _context.portMapper().getPort(PortMapper.SVC_EEPSITE) == _port) {
_port = 0;
_context.portMapper().unregister(PortMapper.SVC_EEPSITE);
}
changeState(STOPPED);
}
}

View File

@@ -167,13 +167,22 @@ public class HomeHelper extends HelperBase {
ctx.router().saveConfig(prop, buf.toString());
}
private static String renderApps(Collection<App> apps) {
private String renderApps(Collection<App> apps) {
String website = _("Website");
StringBuilder buf = new StringBuilder(1024);
buf.append("<div class=\"appgroup\">");
for (App app : apps) {
String url;
if (app.name.equals(website) && app.url.equals("http://127.0.0.1:7658/")) {
// fixup eepsite link
url = "http://" + _context.portMapper().getHost(PortMapper.SVC_EEPSITE, "127.0.0.1") +
':' + _context.portMapper().getPort(PortMapper.SVC_EEPSITE, 7658) + '/';
} else {
url = app.url;
}
buf.append("<div class=\"app\">" +
"<div class=\"appimg\">" +
"<a href=\"").append(app.url).append("\">" +
"<a href=\"").append(url).append("\">" +
"<img class=\"");
// toopie is 54x68, not 16x16, needs special alignment and sizing
if (app.icon.endsWith("/itoopie_sm.png"))
@@ -184,7 +193,7 @@ public class HomeHelper extends HelperBase {
"</div>" +
"<table class=\"app\"><tr class=\"app\"><td class=\"app\">" +
"<div class=\"applabel\">" +
"<a href=\"").append(app.url).append("\" title=\"").append(app.desc).append("\">").append(app.name).append("</a>" +
"<a href=\"").append(url).append("\" title=\"").append(app.desc).append("\">").append(app.name).append("</a>" +
"</div>" +
"</td></tr></table>" +
"</div>\n");

View File

@@ -11,6 +11,7 @@ import java.util.Map;
import net.i2p.crypto.SigType;
import net.i2p.data.DataHelper;
import net.i2p.router.RouterContext;
import net.i2p.util.PortMapper;
/**
* Refactored from summarynoframe.jsp to save ~100KB
@@ -146,7 +147,11 @@ public class SummaryBarRenderer {
.append(nbsp(_("Torrents")))
.append("</a>\n" +
"<a href=\"http://127.0.0.1:7658/\" target=\"_blank\" title=\"")
"<a href=\"http://")
.append(_context.portMapper().getHost(PortMapper.SVC_EEPSITE, "127.0.0.1"))
.append(':')
.append(_context.portMapper().getPort(PortMapper.SVC_EEPSITE, 7658))
.append("/\" target=\"_blank\" title=\"")
.append(_("Local web server"))
.append("\">")
.append(nbsp(_("Website")))