Monday, May 31, 2010

How to read web.xml parameters from GWT

Hi,

How do I read parameters stored in /WEB-INF/web.xml from my
GreetingServiceImpl class?

After I insert following snipplet int web.xml:

<init-param>
<param-name>dbHost</param-name>
<param-value>192.168.120.120</param-value>
</init-param>
<init-param>
<param-name>dbName</param-name>
<param-value>my_database</param-value>
</init-param>

Is anything like this possible:

public class GreetingServiceImpl extends RemoteServiceServlet
implements GreetingService {
public String greetServer(String input) throws
IllegalArgumentException {
Series<Parameter> parameters = getContext().getParameters();
String strHost = parameters.getFirstValue("dbHost");
String strName = parameters.getFirstValue("dbName");
return "The target database is " + strName + "@" + strHost;
}
}


Thanx for your help and cheers!

mm

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
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