use of org.springframework.boot.web.server.WebServer in project spring-boot by spring-projects.
the class JettyReactiveWebServerFactory method getWebServer.
@Override
public WebServer getWebServer(HttpHandler httpHandler) {
JettyHttpHandlerAdapter servlet = new JettyHttpHandlerAdapter(httpHandler);
Server server = createJettyServer(servlet);
return new JettyWebServer(server, getPort() >= 0);
}
use of org.springframework.boot.web.server.WebServer 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);
}
use of org.springframework.boot.web.server.WebServer in project spring-boot by spring-projects.
the class ReactiveWebServerApplicationContext method finishRefresh.
@Override
protected void finishRefresh() {
super.finishRefresh();
WebServer localServer = startReactiveWebServer();
if (localServer != null) {
publishEvent(new ReactiveWebServerInitializedEvent(localServer, this));
}
}
use of org.springframework.boot.web.server.WebServer in project spring-boot by spring-projects.
the class ReactiveWebServerApplicationContext method stopAndReleaseReactiveWebServer.
private void stopAndReleaseReactiveWebServer() {
WebServer localServer = this.webServer;
if (localServer != null) {
try {
localServer.stop();
this.webServer = null;
} catch (Exception ex) {
throw new IllegalStateException(ex);
}
}
}
use of org.springframework.boot.web.server.WebServer in project spring-boot by spring-projects.
the class ServletWebServerApplicationContext method finishRefresh.
@Override
protected void finishRefresh() {
super.finishRefresh();
WebServer webServer = startWebServer();
if (webServer != null) {
publishEvent(new ServletWebServerInitializedEvent(this, webServer));
}
}
Aggregations