I am facing the error:
Failed to load resource: the server responded with a status of 415 (Unsupported Media Type)
AJAX portion of my code is as follows:
$.ajax({
url: '/authentication/editUser',
type: "POST",
contentType: "application/json",
data: JSON.stringify(requestObj), //Stringified JSON Object
success: function(resposeJsonObject) {
//
}
});
And the controller's handler method:
@RequestMapping(value = "/editUser", method = RequestMethod.POST,
headers = {"Content-type=application/json"})
@ResponseBody
public EditUserResponse editUserpost(@RequestBody EditUserRequest editUserRequest) {
System.out.println(editUserRequest);
return new EditUserResponse();
}
How to resolve the error?
Aucun commentaire:
Enregistrer un commentaire