I have the following code that works:
@RequestMapping(value = "/jsonasclass", method = RequestMethod.POST, produces = "application/json")
public @ResponseBody
ContactVO jsonAsClassPost(@RequestBody ContactVO ct){
ct.setFirstName("This-property-is-changed-in-the-controller");
return ct;
}
and the corresponding ajax call by post:
$.ajax({
url: '/jsonasclass/',
type: 'POST',
dataType: 'json',
data: JSON.stringify({
id:1,
userID:1.1,
login:'sample-login',
firstName:'sample-first-name'
}),
contentType: 'application/json',
mimeType: 'application/json',
success: _callBack,
error: _errorCallback
});
Now I want to achieve the same thing, but I want to do it by GET. Anyone knows how?
- I have tried changing POST to GET (in both controller and ajax call) but it did not work.
- The error I get: description The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.