[jax-rs-spec users] [jsr339-experts] Re: Filters and generic entities

From: Sergey Beryozkin <>
Date: Tue, 19 Mar 2013 21:20:44 +0000

On 18/03/13 17:13, Sergey Beryozkin wrote:
> Hi
> What ContainerResponseFilter should return in getEntity(),
> getEntityClass() and getEntityType(), when the application code uses
> GenericEntity class ?
> I'm thinking that GenericEntity needs to be 'unwrapped' by the filter
> context implementation, but then if the filter implementation sets
> "new GenericEntity..." then I guess it needs to get it back, in
> getEntity(), so may be after all
> getEntity(), getEntityClass() and getEntityType()
> should return GenericEntity instance + GenericEntity.class ?

I'm still thinking that 'unwrapping' GenericEntity makes sense even if a
given filter replaces a current entity with GenericEntity, after all the
filter which replaces an entity is more interested in the follow-up
filters and writers to get the updates.

So, to summarize, relevant ContainerResponseFilter getters should never
return GenericEntity if the current entity happens to be GenericEntity
(instance, class, type) but unwrap it.

Agreed ?

Cheers, Sergey

> Thanks, Sergey