|
|
|
@ -17,7 +17,9 @@
|
|
|
|
|
package org.springframework.boot.web.embedded.jetty;
|
|
|
|
|
|
|
|
|
|
import java.net.BindException;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.logging.Log;
|
|
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
|
@ -25,6 +27,7 @@ import org.eclipse.jetty.server.Connector;
|
|
|
|
|
import org.eclipse.jetty.server.Handler;
|
|
|
|
|
import org.eclipse.jetty.server.NetworkConnector;
|
|
|
|
|
import org.eclipse.jetty.server.Server;
|
|
|
|
|
import org.eclipse.jetty.server.handler.ContextHandler;
|
|
|
|
|
import org.eclipse.jetty.server.handler.HandlerCollection;
|
|
|
|
|
import org.eclipse.jetty.server.handler.HandlerWrapper;
|
|
|
|
|
import org.eclipse.jetty.util.component.AbstractLifeCycle;
|
|
|
|
@ -44,6 +47,7 @@ import org.springframework.util.StringUtils;
|
|
|
|
|
* @author David Liu
|
|
|
|
|
* @author Eddú Meléndez
|
|
|
|
|
* @author Brian Clozel
|
|
|
|
|
* @author Kristine Jetzke
|
|
|
|
|
* @since 2.0.0
|
|
|
|
|
* @see JettyReactiveWebServerFactory
|
|
|
|
|
*/
|
|
|
|
@ -151,7 +155,8 @@ public class JettyWebServer implements WebServer {
|
|
|
|
|
}
|
|
|
|
|
this.started = true;
|
|
|
|
|
JettyWebServer.logger
|
|
|
|
|
.info("Jetty started on port(s) " + getActualPortsDescription());
|
|
|
|
|
.info("Jetty started on port(s) " + getActualPortsDescription()
|
|
|
|
|
+ " with context path " + getContextPath());
|
|
|
|
|
}
|
|
|
|
|
catch (WebServerException ex) {
|
|
|
|
|
throw ex;
|
|
|
|
@ -190,6 +195,13 @@ public class JettyWebServer implements WebServer {
|
|
|
|
|
return " (" + StringUtils.collectionToDelimitedString(protocols, ", ") + ")";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String getContextPath() {
|
|
|
|
|
return Arrays.stream(this.server.getHandlers())
|
|
|
|
|
.filter(ContextHandler.class::isInstance)
|
|
|
|
|
.map(handler -> ((ContextHandler) handler).getContextPath())
|
|
|
|
|
.collect(Collectors.joining(" "));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void handleDeferredInitialize(Handler... handlers) throws Exception {
|
|
|
|
|
for (Handler handler : handlers) {
|
|
|
|
|
if (handler instanceof JettyEmbeddedWebAppContext) {
|
|
|
|
|