Ideally your build tool should put your environment into prod or dev mode and the GWT app shouldn't know/care about it. With Maven / Gradle / Ant you can use "resource filtering" to rewrite resources like property files while being copied to the output folder.
In that case you would have
Config.properties:
key = ${key}
dev.properties:
key = devValue
prod.properties:
key = prodValue
and the build tool will replace ${key} with the value of one of the other two files before GWT will pick up config.properties.
Otherwise you might try (no idea if it works):
interface Config extends Constants {...}
interface DevConfig extends Config {...} -> create a file DevConfig.properties
interface ProdConfig extends Config {...} -> create a file ProdConfig.properties
and in Java code
Config config;
if ("dev".equals(System.getProperty("env")) {
config = GWT.create(DevConfig.class);
} else if ("prod".equals(......)) {
.....
}
Can't remember, but System.getProperty() might require GWT 2.8.
-- J.
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment