Created
May 6, 2015 10:20
-
-
Save BenDol/61addf82a024847a5ab9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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