How do I send array parameter with Spring RestTemplate?
This is the server side implementation:
@RequestMapping(value = \"/train\", method = RequestM
I ended up constructing the URL by looping through the collection.
Map map = new HashMap();
map.put("category", parameters.getName());
String url = "http://localhost:8080/admin/train?category={category}";
if (positiveDocs != null && positiveDocs.size() > 0) {
for (String id : positiveDocs) {
url += "&positiveDocId[]=" + id;
}
}
if (negativeDocId != null && negativeDocId.size() > 0) {
for (String id : negativeDocId) {
url += "&negativeDocId[]=" + id;
}
}
TrainResponse response = restTemplate.getForObject(url, TrainResponse.class, map);