lundi 30 mars 2015

how to check if field is exist or not in @RequestBody?

I am developing spring web application that simply accept the request data and process request. In between the request data is validated using spring validator. it works fine.


but when I am changin field name then it throws an error so I want to handle this exception. and I don't have any idea related to it.


suppose my class:



MRequest{
private String name;
private String description;
// getter-setter
}


and if will send REST post request like:



{
"name": "abc",
"descriptio": ""
}


then it throws an exception of mismatch field of descriptio.


So i want to handle this exception, any suggestion guys.


Aucun commentaire:

Enregistrer un commentaire