views:

86

answers:

1

I'm trying to make a calculator web service that has more than 10 parameters. Is there any function in the Java Restlet or in Java itself that allows you to see the parameter ids?

e.g. http://mywebsite.com/calculator?id1=value1&id2=value2&id3=value3 => I'm trying to access the values of id1, id2, and id3 so that I don't have to require people using the web service to input all parameters (some of them are likely to be 0).

A: 

Not familiar with reslets. However, if you have access to the HttpServletRequest object you can make use of the getParameterMap method. This method will return a Map, which will allow you to access the parameter names using the getKeySet method. Be sure to take note that the Map that is returned uses a string array as its value type and not an ordinary string (this is so you can see multiple parameters which have the same name).

BigZig