I think this should do the trick in Jersey 2.0.
ContainerRequest.readEntity(Class);
- Arul
On Sat, Jun 22, 2013 at 8:39 PM, cowwoc <cowwoc_at_bbs.darktech.org> wrote:
> Hi,
>
> What is the equivalent of HttpRequestContext.getEntity(**Class) for
> Jersey 2.x? I see ContainerRequestContext.**getEntityStream() but how do
> I go from this InputStream to a POJO?
>
> My use-case is as follows: when a resource attempts to parse the
> request entity, I'd like to log the entity's String representation so I can
> reproduce the problem at a later time. In the past I used to:
>
> 1. Cache the entity before it was read by the resource.
> 2. Invoke HttpRequestContext.getEntity(**String.class).
>
> I know it's relatively simply to construct a String from an
> InputStream but tomorrow I might want to construct some other arbitrary
> POJO from the InputStream, which brings us back to what is the equivalent
> of HttpRequestContext.getEntity(**Class) for Jersey 2.x?
>
> Thanks,
> Gili
>