users@jersey.java.net

[Jersey] How to intercept response and get original entitiy object?

From: <marceloverdijk_at_gmail.com>
Date: Thu, 22 Aug 2013 06:48:15 +0000 (UTC)

My resource method is returning a javax.json.JsonObject containing
data.

I want to intercept this response, and enhance the JsonObject with
additional data.

Is this possible in an interceptor?


The use case is I want to implement "suppress response codes"
functionality similar to Twitters api.
If a certain request parameter is present in the api request (e.g.
?suppress_response_codes=true) I want to wrap my actual response in
something like:
{ "status": 200,
  "response": { .. }
}