@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); }
static GroovyEmbeddedApp fromHandlers( @DelegatesTo(value = GroovyChain.class, strategy = Closure.DELEGATE_FIRST) Closure<?> handlers) { return from(EmbeddedApp.fromHandlers(Groovy.chainAction(handlers))); }
static GroovyEmbeddedApp fromHandler( @DelegatesTo(value = GroovyContext.class, strategy = Closure.DELEGATE_FIRST) Closure<?> handler) { return from(EmbeddedApp.fromHandler(Groovy.groovyHandler(handler))); }