use of org.webpieces.nio.api.SSLConfiguration in project webpieces by deanhiller.
the class WebServerImpl method startBackendServer.
private XFuture<Void> startBackendServer(Injector injector, InetSocketAddress backendAddress) {
XFuture<Void> fut33;
// This is inside the if statement BECAUSE we do not need to bind an SSLConfiguration if they do not
// enable the backend or https ports
SSLConfiguration sslConfiguration = injector.getInstance(SSLConfiguration.class);
String type = "https";
if (sslConfiguration.getBackendSslEngineFactory() == null)
type = "http";
String serverName = "backend." + type;
log.info("Creating and starting the " + serverName + " over port=" + backendAddress + " AND using '" + type + "'");
HttpSvrConfig httpSvrConfig = new HttpSvrConfig(serverName, backendAddress, 10000);
httpSvrConfig.asyncServerConfig.functionToConfigureBeforeBind = s -> configure(s);
SSLEngineFactory factory = (SSLEngineFactory) sslConfiguration.getBackendSslEngineFactory();
backendServer = serverMgr.createBackendHttpsServer(httpSvrConfig, serverListener, factory);
fut33 = backendServer.start();
return fut33;
}
Aggregations