I am trying to implement a small utility class / library that should be useable on client side and on server side but has different implementation on client and server.
For example I have a utility method that should make a http REST call. On client side I should use RequestBuilder but on server side I have to use java.net.* classes. How would I do that?
I tried the factory approach in combination with GWT.isScript() but this didn't work because the GWT compiler still sees java.net.* classes and wants to translate them:
public class SharedUtils {
private static final SharedUtilsFactory FACTORY = GWT.isScript() ?
new SharedUtilsFactoryJS() : new SharedUtilsFactoryVM();
public static RequestUtils requestUtils() {
return FACTORY.requestUtils();
}
}
Shouldn't this somehow be possible?
Thanks for help,
-- J.
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/0Vun73wjMvcJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment