Search in sources :

Example 1 with RatpackDslClosures

use of ratpack.groovy.internal.capture.RatpackDslClosures in project ratpack by ratpack.

the class RatpackClosureConfigurer method execute.

@Override
public void execute(RatpackServerSpec server) throws Exception {
    RatpackDslClosures closures = new RatpackDslClosures(null);
    RatpackDslBacking backing = new RatpackDslBacking(closures);
    ClosureUtil.configureDelegateFirst(backing, closure);
    server.registry(Guice.registry(ClosureUtil.delegatingAction(closures.getBindings())));
    server.handlers(Groovy.chainAction(closures.getHandlers()));
    ServerConfigBuilder builder = ServerConfig.builder().development(true);
    if (ephemeralPort) {
        builder.port(0);
    }
    ClosureUtil.configureDelegateFirst(builder, closures.getServerConfig());
    server.serverConfig(builder);
}
Also used : RatpackDslClosures(ratpack.groovy.internal.capture.RatpackDslClosures) ServerConfigBuilder(ratpack.server.ServerConfigBuilder) RatpackDslBacking(ratpack.groovy.internal.capture.RatpackDslBacking)

Aggregations

RatpackDslBacking (ratpack.groovy.internal.capture.RatpackDslBacking)1 RatpackDslClosures (ratpack.groovy.internal.capture.RatpackDslClosures)1 ServerConfigBuilder (ratpack.server.ServerConfigBuilder)1