Ok, I am uisng GWTP, it got Client, Server & Shared package.
I have a Util class in client.
my.client.Util.java{
public static String method1();
//more methods here
}
In server i have
my.server.GetDataActionHandler{
///Should I do like this
String s=my.client.Util.method1();
}
Is it safe to do that or I should put Util into shared package, like this
my.shared.Util.java{
public static String method1();
//more methods here
}
What is the different if we put a Util in shared package? is it safer or any other good reasons?
client
is as safe as shared
, these are just names and conventions.
By placing your class in client
though, you lose the indication that you're using it also on the server side, where client-specific code won't run.
By placing it in shared
, you're signaling to yourself that you should make sure the code your put in the class can effectively be used in both the client and the server.