Hi, i want to build an Uri for an Webservice. I use the UriBuilder and want to add the parameters to the URI. The paramameters are saved in an MultivaluedMap.
@GET
@PathParam("/{callUrl}/{parameters}")
public static String buildGetUri(@PathParam("callUrl") String callUrl,
@PathParam("parameters") MultivaluedMap<String, String> params)
{
System.out.println("building started...");
URI uri = UriBuilder.fromUri(callUrl).buildFromMap(params);
System.out.println("-------------------------");
System.out.println("params.size: " + params.size());
System.out.println("callurl: " + callUrl);
String key = "testkey";
String value = "testvalue";
params.add(key, value);
System.out.println("params.size: " + params.size());
String sUri = uri.toString();
System.out.println("stringGetUri: " + sUri);
System.out.println("building finished...");
System.out.println("-------------------------");
return sUri;
}
The test System.out.printlns look like this:
-------------------------
params.size: 1
callurl: /cdp/release/services/geocoding/service/geocode
params.size: 2
stringUri: /cdp/release/services/geocoding/service/geocode
building finished...
-------------------------
You can see that the Map is not empty. How can i add the parameters of the map to the URI?
Thanks in advance!