propagate from branch 'i2p.i2p.zzz.jetty9' (head 80022f6ef552acd1382d45103969aa7c17b1d794)

to branch 'i2p.i2p' (head 3b4b418ae8be95d52228fc7c325fc52e0223e4fe)
This commit is contained in:
zzz
2017-03-11 15:24:23 +00:00
86 changed files with 1652 additions and 812 deletions

View File

@@ -109,17 +109,30 @@ 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
// defaults aren't set yet when we call the above. So we have to get the defaults.
// Without the default configuration, the web.xml isn't read, and the webapp
// won't respond to any requests, even though it appears to be running.
// See WebAppContext.loadConfigurations() in source
if (classNames.length == 0)
classNames = wac.getDefaultConfigurationClasses();
String[] newClassNames = new String[classNames.length + 1];
for (int j = 0; j < classNames.length; j++)
newClassNames[j] = classNames[j];
newClassNames[classNames.length] = WebAppConfiguration.class.getName();
wac.setConfigurationClasses(newClassNames);
server.addHandler(wac);
server.mapContexts();
return wac;
}
/**