On Oct 12, 2010, at 3:10 PM, Alexander Chuprin wrote:
> Hello.
>
> All my resource methods returns Response type. I want to add field
> to all response enities depend in response status. I use
> MessageBodyWriter to json serialization. I want to add field to json
> depends on response status. In example i want to add success:true if
> my method returns Response.ok(entity).build() but don't have
> response status in writeable method.
>
> Is there ways to add this logic?
>
You can inject the Jersey interface:
@Context HttpContext hc;
then do:
hc.getResponse().getStatus();
Paul.