Search in sources :

Example 6 with AbstractConnector

use of org.eclipse.jetty.server.AbstractConnector in project spring-boot by spring-projects.

the class JettyServletWebServerFactory method getWebServer.

@Override
public WebServer getWebServer(ServletContextInitializer... initializers) {
    JettyEmbeddedWebAppContext context = new JettyEmbeddedWebAppContext();
    int port = (getPort() >= 0 ? getPort() : 0);
    InetSocketAddress address = new InetSocketAddress(getAddress(), port);
    Server server = createServer(address);
    configureWebAppContext(context, initializers);
    server.setHandler(addHandlerWrappers(context));
    this.logger.info("Server initialized with port: " + port);
    if (getSsl() != null && getSsl().isEnabled()) {
        SslContextFactory sslContextFactory = new SslContextFactory();
        configureSsl(sslContextFactory, getSsl());
        AbstractConnector connector = createSslConnector(server, sslContextFactory, port);
        server.setConnectors(new Connector[] { connector });
    }
    for (JettyServerCustomizer customizer : getServerCustomizers()) {
        customizer.customize(server);
    }
    if (this.useForwardHeaders) {
        new ForwardHeadersCustomizer().customize(server);
    }
    return getJettyWebServer(server);
}
Also used : SslContextFactory(org.eclipse.jetty.util.ssl.SslContextFactory) Server(org.eclipse.jetty.server.Server) WebServer(org.springframework.boot.web.server.WebServer) InetSocketAddress(java.net.InetSocketAddress) AbstractConnector(org.eclipse.jetty.server.AbstractConnector)

Aggregations

AbstractConnector (org.eclipse.jetty.server.AbstractConnector)6 Connector (org.eclipse.jetty.server.Connector)5 ConnectionStatistics (org.eclipse.jetty.io.ConnectionStatistics)3 PrintStream (java.io.PrintStream)2 PrintWriter (java.io.PrintWriter)2 ConnectorStatistics (org.eclipse.jetty.server.ConnectorStatistics)2 Server (org.eclipse.jetty.server.Server)2 RolloverFileOutputStream (org.eclipse.jetty.util.RolloverFileOutputStream)2 InetSocketAddress (java.net.InetSocketAddress)1 ArrayList (java.util.ArrayList)1 ConstraintMapping (org.eclipse.jetty.security.ConstraintMapping)1 ConstraintSecurityHandler (org.eclipse.jetty.security.ConstraintSecurityHandler)1 HashLoginService (org.eclipse.jetty.security.HashLoginService)1 BasicAuthenticator (org.eclipse.jetty.security.authentication.BasicAuthenticator)1 Handler (org.eclipse.jetty.server.Handler)1 NCSARequestLog (org.eclipse.jetty.server.NCSARequestLog)1 ServerConnector (org.eclipse.jetty.server.ServerConnector)1 ShutdownMonitor (org.eclipse.jetty.server.ShutdownMonitor)1 ContextHandler (org.eclipse.jetty.server.handler.ContextHandler)1 ContextHandlerCollection (org.eclipse.jetty.server.handler.ContextHandlerCollection)1