如何根据多个参数过滤Web服务结果?

时间:2013-06-17 15:33:23

标签: web-services spring rest filter

要过滤多个参数,请使用此Web服务调用:

http://mysite/sites/test/_vti_bin/listdata.svc/Values?$filter=param1%20eq%20'test1'%20and%20param2%20eq%20'test2'

但是如何以编程方式使用此过滤器?

要调用Web服务并在Java中传递过滤器名称和值,我使用:

Map<String, String> variables = new HashMap<String, String>();
variables.put("filterName", "param1");
variables.put("filterValue", "test1");

然后调用:

readOnlyRestTemplate.getForObject(url, String, variables);

这适用于过滤一个参数。但是如何根据多个参数进行过滤,在这个例子中包含名称/值对'param2 / test2'?

0 个答案:

没有答案