I have a GWT Server which will connect o another server via RMI or CustomConnection. I would like to have a way of telling the GWT Server which connection type to use.
What I could think of :
- Adding custom tag in
web.xml - Create a normal file containing the value of the connection
Which one is better? And do you know any other optimal way?
If you know at startup time, I would go with a initialization parameter:
http://docs.oracle.com/cd/E11035_01/wls100/webapp/progservlet.html#wp159396
For example, the following entries in the Java EE standard Web Application deployment descriptor, web.xml, define two initialization parameters: greeting, which has a value of Welcome and person, which has a value of WebLogic Developer.
To retrieve initialization parameters, call the getInitParameter(String name) method from the parent javax.servlet.GenericServlet class. When passed the name of the parameter, this method returns the parameter’s value as a String.
Overriding the init() Method
You can have your servlet execute tasks at initialization time by overriding the init() method. The following code fragment reads the tags that define a greeting and a name in the J2EE standard Web Application deployment descriptor, web.xml: