@Override public RestDispatchAsyncModule build() { return new RestDispatchAsyncModule(this); }
@Override protected void configureDispatch() { // Common install(new CommonGinModule()); install(new SerializationModule()); install(builder.getCoreModule()); bind(RestFilterRegistry.class).to(builder.getFilterRegistry()).in(Singleton.class); // Constants / Configurations // It's not possible to bind non-native type constants, so we must encode them at compile-time and decode them // at runtime (ie: Global Parameters) String globalHeaderParams = bindingsSerializer.serialize(builder.getGlobalHeaderParams()); String globalQueryParams = bindingsSerializer.serialize(builder.getGlobalQueryParams()); bindConstant().annotatedWith(XsrfHeaderName.class).to(builder.getXsrfTokenHeaderName()); bindConstant().annotatedWith(RequestTimeout.class).to(builder.getRequestTimeoutMs()); bindConstant().annotatedWith(DefaultDateFormat.class).to(builder.getDefaultDateFormat()); bindConstant().annotatedWith(GlobalHeaderParams.class).to(globalHeaderParams); bindConstant().annotatedWith(GlobalQueryParams.class).to(globalQueryParams); }
@Override protected void configure() { install(new DefaultModule.Builder() .tokenFormatter(RouteTokenFormatter.class) .defaultPlace(NameTokens.HOME) .errorPlace(NameTokens.HOME) .unauthorizedPlace(NameTokens.HOME) .build()); install(new RestDispatchAsyncModule()); install(new ApplicationModule()); bind(ResourceLoader.class).asEagerSingleton(); bindConstant().annotatedWith(RestApplicationPath.class).to("/api"); bind(MyGatekeeper.class).in(Singleton.class); } }