Move setting of InstanceManager to WebAppConfiguration to avoid race

Fix up LICENSES.txt
Build.xml cleanup
Debian:
- Add support for with-libtomcat8-java but not with-libjetty9-java for wheezy/jessie
- Fix wheezy/precise/trusty build files to use tomcat8 but not jetty9 packages
- Remove build dependency on ant-optional, not required
- Remove some remaining eclipse-ecj dependencies
- Add short README files for wheezy and jessie
This commit is contained in:
zzz
2017-03-04 14:24:48 +00:00
parent ec6c24429a
commit f38ee48ca3
22 changed files with 155 additions and 116 deletions

View File

@@ -10,7 +10,6 @@ import net.i2p.router.RouterContext;
import net.i2p.util.FileUtil;
import net.i2p.util.SecureDirectory;
import org.apache.tomcat.SimpleInstanceManager;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandler;
@@ -64,11 +63,6 @@ public class WebAppStarter {
// and the caller will know it failed
wac.setThrowUnavailableOnStartupException(true);
wac.start();
// can't do this before start
// do we just need one, in the ContextHandlerCollection, or one for each?
// http://stackoverflow.com/questions/17529936/issues-while-using-jetty-embedded-to-handle-jsp-jasperexception-unable-to-com
// https://github.com/jetty-project/embedded-jetty-jsp/blob/master/src/main/java/org/eclipse/jetty/demo/Main.java
wac.getServletContext().setAttribute("org.apache.tomcat.InstanceManager", new SimpleInstanceManager());
}
/**
@@ -115,7 +109,16 @@ public class WebAppStarter {
// this does the passwords...
RouterConsoleRunner.initialize(ctx, wac);
setWebAppConfiguration(wac);
server.addHandler(wac);
server.mapContexts();
return wac;
}
/**
* @since Jetty 9
*/
static void setWebAppConfiguration(WebAppContext wac) {
// see WebAppConfiguration for info
String[] classNames = wac.getConfigurationClasses();
// In Jetty 9, it doesn't set the defaults if we've already added one, but the
@@ -130,9 +133,6 @@ public class WebAppStarter {
newClassNames[j] = classNames[j];
newClassNames[classNames.length] = WebAppConfiguration.class.getName();
wac.setConfigurationClasses(newClassNames);
server.addHandler(wac);
server.mapContexts();
return wac;
}
/**