diff --git a/src/main/java/io/sinistral/proteus/ProteusApplication.java b/src/main/java/io/sinistral/proteus/ProteusApplication.java index 8d32ad3..be7cd63 100644 --- a/src/main/java/io/sinistral/proteus/ProteusApplication.java +++ b/src/main/java/io/sinistral/proteus/ProteusApplication.java @@ -11,6 +11,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -81,6 +82,7 @@ public class ProteusApplication protected HttpHandler rootHandler; protected AtomicBoolean running = new AtomicBoolean(false); protected List ports = new ArrayList<>(); + protected Function serverConfigurationFunction = null; public ProteusApplication() @@ -245,6 +247,7 @@ public void buildServer() .setWorkerThreads( config.getInt("undertow.workerThreads") ) .setHandler( handler ); + ports.add(config.getInt("application.ports.http")); if( config.getBoolean("undertow.ssl.enabled") ) @@ -270,6 +273,11 @@ public void buildServer() } } + if( serverConfigurationFunction != null ) + { + undertowBuilder = serverConfigurationFunction.apply(undertowBuilder); + } + this.undertow = undertowBuilder.build(); } @@ -309,6 +317,15 @@ public Undertow getUndertow() } + /** + * Allows direct access to the Undertow.Builder for custom configuration + * @param serverConfigurationFunction the serverConfigurationFunction + */ + public void setServerConfigurationFunction(Function serverConfigurationFunction) + { + this.serverConfigurationFunction = serverConfigurationFunction; + } + /** * @return the serviceManager */