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

Popular posts from this blog

Linux vanilla kernel on QEMU and networking with eth0 -

rdbms - what exactly the undo information lives in oracle? -

clojure - 'get' replacement that throws exception on not found? -