jackson - Set Jersey to Default to JSON -
i using jersey jackson. want default endpoints (defined or not) return json.
let's have /hello endpoint produces application/json on get. if call /hello post, returning xml.
how 1 configure default json instead of xml?
i think found answer this. have not tested yet, pretty sure work.
@provider public class commonexceptionmapper implements exceptionmapper<exception> { @override public response toresponse(exception exception) { return response.status(statuscode).type(mediatype.application_json).entity(resterror).build(); } } i missing .type().
Comments
Post a Comment