RatpackServerSpec function ( Class < ? extends Handler > arg0 ) { return handler ( registry -> registry . get ( arg0 ) ) ; }
sets the root handler by getting a handler of the given type from the server registry . this can be useful when integrating with something that can wire together objects , such as google guice . import ratpack.guice.guice ; import ratpack.handling.context ; import ratpack.handling.handler ; import ratpack.test.embed.embeddedapp ; import javax.inject.inject ; import static org.junit.assert.assertequals ; public class example public static class myhandler implements handler private final string value ; @literal @ inject public myhandler string value this.value = value ; public void handle context ctx throws exception ctx.render value ; public static void main string ... args throws exception embeddedapp.of s - > s . registry guice.registry b - > b . bindinstance `` hello world ! '' . bind myhandler.class . handler myhandler.class . test httpclient - > assertequals `` hello world ! '' , httpclient.gettext ; concode_field_sep PlaceHolder placeHolder concode_field_sep RatpackServerSpec registry concode_elem_sep RatpackServerSpec registry concode_elem_sep RatpackServerSpec registryOf concode_elem_sep RatpackServerSpec handlers concode_elem_sep RatpackServerSpec serverConfig concode_elem_sep RatpackServerSpec serverConfig concode_elem_sep RatpackServerSpec serverConfig