Пример #1
0
 @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);
 }
Пример #2
0
 static GroovyEmbeddedApp fromHandlers(
     @DelegatesTo(value = GroovyChain.class, strategy = Closure.DELEGATE_FIRST)
         Closure<?> handlers) {
   return from(EmbeddedApp.fromHandlers(Groovy.chainAction(handlers)));
 }
Пример #3
0
 static GroovyEmbeddedApp fromHandler(
     @DelegatesTo(value = GroovyContext.class, strategy = Closure.DELEGATE_FIRST)
         Closure<?> handler) {
   return from(EmbeddedApp.fromHandler(Groovy.groovyHandler(handler)));
 }