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

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -