Server Configuration Constants in GWT

I need some configuration files that can be changed without recompiling the project in my GWT application. However, the GWT i18n does not allow the use of servers.

So, what solution do you need to use serveride to get the configuration constants?

Thanks.

+4
source share
2 answers

If you only need them on the server side, go with the standard java.util.Properties class. If you want to share the constants between them, then create an additional RPC service call to get a list of properties for your client.

0
source

Getting server-side GWT i18n interfaces is easy with java.lang.reflect.Proxy .

  • Our team put the properties of the GWT i18n files in the same place as the com.google.gwt.i18n.client.Messages classes that they generate. They are then deployed in the same directory as the class files, somewhere under / classes, and therefore on the path to the Webapp network.

  • Read in the ResourceBundle from the file with the expanded properties. In the previous step, searching for the properties file is simple: this is the name of the GWT i18n interface.

  • GWT i18n's proxy server-side interface and use the InvocationHandler proxy server to search for ownership in the ResourceBundle . Finding the right property is also easy: this is the name of the calling Method .

You now have the GWT i18n interfaces created on the server. You can edit the properties file and reinstall without recompiling. However, the changed constants will not be raised on the client side.

+2
source

Source: https://habr.com/ru/post/1300961/


All Articles