Where I can store configuration parameters in client side? I haven\'t possibility to store parameters in Servlet init parameters(web.xml) (because I must use PHP). So how I
To do this you have a following options:
Configuration
class with hardcoded values.I would recommend you go with third option.
You can use MultiValuedConfigProperties (see also this other helpful tutorial) to store configuration values. Using them, you can store your configuration in your module's .gwt.xml
configuration file. The configuration values will be compiled into the JavaScript output.
Standard, simple and easy way to store non-constant parametres(such as passwords, or any user data) on client side is cookies. See Cookies
Constant parameters you can store in hardcode(static fields in some class) or in resoures .properties files(See GWT i18n constants interface).
PS: I will not recomment you to store password on client side "as is"(it is not safe), instead you can store password hash(md5, for example). Just calculate password hash on server side and store this hash in cookies.
You will probably be very happy using the Dictionary and Cookie classes in GWT.
In your html hosting file, you maintain some javascript objects declared as var.
At module load, call Dictionary class to grab the javascript objects that you have defined to store your config data.
In this way, you could have a server side managed user- or context- sensitive configuration, because occasionally I use JSP to generate the hosting file. I could manage user configuration as server side cookies stored in a database.
So ... today is Thursday ... the user has a history of visiting Manchester Utd FC web site every Thur, etc, let me give the user a different config based on context/user-sensitive algorithm. And on Monday mornings, the user config would include ad data for 10 hour energy beverages.
In this way, your gwt client would not have to request context-sensitive config data from the server.
But then of course, this is no way to store authentication/security data like passwords. I don't think you should even consider storing authentication/security data in client-side code. Even after javascript obfuscation, storing such data this way is an open invitation to persistence of malicious intent. Such data, if client-side storage is desired, would be best served by client-side cookies, using the GWT class Cookies.
Storing passwords on client side? OK, if you want to. Just create a class that will hold them, could be a static field, or a singleton object with all the parameters. Could even be the one with entryPoint()
.