java - jersey: how to configura jersey to return jsons only -
one api endpoint using following annotations:
@consumes(mediatype.application_json) @produces(mediatype.application_json)
when request content-type not application/json
, server return status code 415 response content-type text/html;charset=utf-8
.
how configuration jersey return json default content-type? thanks
i have never tried asking can done use of interceptors
you in particularly looking writerinterceptor
writer interceptors used cases entity written "wire" on server means when writing out response entity , on client side when writing request entity request sent out server
this means when ever client sending response writerinterceptor called. here have power modify (jsonify) response.
wiki
Comments
Post a Comment