Search in sources :

Example 1 with SSLConfiguration

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;
}
Also used : SSLConfiguration(org.webpieces.nio.api.SSLConfiguration) HttpSvrConfig(org.webpieces.frontend2.api.HttpSvrConfig) SSLEngineFactory(org.webpieces.nio.api.SSLEngineFactory)

Aggregations

HttpSvrConfig (org.webpieces.frontend2.api.HttpSvrConfig)1 SSLConfiguration (org.webpieces.nio.api.SSLConfiguration)1 SSLEngineFactory (org.webpieces.nio.api.SSLEngineFactory)1