Skip to content

Instantly share code, notes, and snippets.

@BenDol
Created May 6, 2015 10:20
Show Gist options
  • Save BenDol/61addf82a024847a5ab9 to your computer and use it in GitHub Desktop.
Save BenDol/61addf82a024847a5ab9 to your computer and use it in GitHub Desktop.
public class RestModule extends AbstractGinModule {
@Override
public void configure() {
install(new RestDispatchAsyncModule.Builder()
.addGlobalHeaderParam(RestCache.CACHE_CONTROL)
.toHttpMethods(HttpMethod.GET)
.withValue("no-cache")
.dispatchHooks(RestDispatchHook.class)
.build());
bind(ProtocolRegistry.class).asEagerSingleton();
}
@RestApplicationPath
@Provides String getApplicationPath() {
String baseUrl = GWT.getHostPageBaseURL();
if (baseUrl.endsWith("/")) {
baseUrl = baseUrl.substring(0, baseUrl.length() - 1);
}
return baseUrl + Rest.ROOT;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment