Event jettyStartupEvent = SpeedTracerLogger.start(DevModeEventType.JETTY_STARTUP);
boolean clearCallback = true;
try {
ui.setCallback(RestartServerEvent.getType(), this);
ServletContainerLauncher scl = options.getServletContainerLauncher();
TreeLogger serverLogger = ui.getWebServerLogger(getWebServerName(), scl.getIconBytes());
String sclArgs = options.getServletContainerLauncherArgs();
if (sclArgs != null) {
if (!scl.processArguments(serverLogger, sclArgs)) {
return -1;
}
}
isHttps = scl.isSecure();
// Tell the UI if the web server is secure
if (isHttps) {
ui.setWebServerSecure(serverLogger);
}
/*
* TODO: This is a hack to pass the base log level to the SCL. We'll have
* to figure out a better way to do this for SCLs in general.
*/
if (scl instanceof JettyLauncher) {
JettyLauncher jetty = (JettyLauncher) scl;
jetty.setBaseRequestLogLevel(getBaseLogLevelForUI());
}
scl.setBindAddress(options.getBindAddress());
if (serverLogger.isLoggable(TreeLogger.TRACE)) {
serverLogger.log(TreeLogger.TRACE, "Starting HTTP on port " + getPort(), null);
}
server = scl.start(serverLogger, getPort(), options.getWarDir());
assert (server != null);
clearCallback = false;
return server.getPort();
} catch (BindException e) {
System.err.println("Port " + options.getBindAddress() + ':' + getPort()