I\'m using Jersey\'s integrated Jackson processing to transform incoming JSON to a POJO, e.g.:
@POST
@Consumes(MediaType.APPLICATION_JSON)
public Response newCus
I've had this same problem... Unfortunately, there's no good way that I know of to intercept the Jackson exception and generate your own error code.
One option you have is to use @JsonIgnoreProperties
and then strictly validate the deserialized object. This won't tell you if your sender transmitted junk, but if they missed required fields, you'll catch that.
I cannot find any way to access the actual JSON passed in, other than creating an @Provider class to trap the JSON, validate it, then pass it to Jackson for deserialization.