I have a method on the Server side which gives me information about an specific name registered in my database. I'm accessing it from my Android application.
The request to Server is done normally. What I'm trying to do is to pass parameter to the server depending on the name I want to get.
Here's my Server side method:
@RequestMapping("/android/played")
public ModelAndView getName(String name) {
System.out.println("Requested name: " + name);
........
}
Here's the Android request to it:
private Name getName() {
RestTemplate restTemplate = new RestTemplate();
// Add the String message converter
restTemplate.getMessageConverters().add(
new MappingJacksonHttpMessageConverter());
restTemplate.setRequestFactory(
new HttpComponentsClientHttpRequestFactory());
String url = BASE_URL + "/android/played.json";
String nome = "Testing";
Map<String, String> params = new HashMap<String, String>();
params.put("name", nome);
return restTemplate.getForObject(url, Name.class, params);
}
In the server side, I'm only getting:
Requested name: null
Is it possible to send parameters to my Server like this?