Server Side
@RequestMapping (value="url",method=RequestMethod.GET)
public @ResponseBody String sampleMethod (@RequestBody String json){
ObjectMapper mapper = new ObjectMapper();
HashMap<Object, Object> params = new HashMap<Object,Object>();
params = mapper.readValue(json, new TypeReference<Map<String,Object>>() { });
return "";
}
Client Side
jQuery(document).ready(function(){
var datas = {id:"id",password:"password"};
jQuery.ajax({
type: "POST",
url: 'http://localhost:8080/url',
data: JSON.stringify(datas),
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result){
if (result.status != 0){
return;
}
},
error: function (){
alert ("Error");
}
});
});
Result : java.io.EOFException: No content to map to Object due to end of input
symptom : method=RequestMethod.GET change to POST