jsr339-experts@jax-rs-spec.java.net

[jsr339-experts] Re: ContainerResponseContext.getEntityAnnotations() discrepancy

From: Bill Burke <bburke_at_redhat.com>
Date: Fri, 17 May 2013 10:45:53 -0400

On 5/17/2013 10:41 AM, Sergey Beryozkin wrote:
> Hi Bill
> On 17/05/13 15:35, Bill Burke wrote:
>> The TCK test lead and I are both interpreting
>> ContainerResponseContext.getEntityAnnotations()
>>
>> IMO, if the app code has attached an entity view
>>
>> ResponseBuilder.entity(Object, Annotation[])
>>
>> then only those attached annotations should be returned by
>> getEntityAnnotations().
>>
>>
>> The TCK test lead is saying that both those annotations *AND* the
>> annotations on the resource method should be returned.
>>
>>
>> The language in the spec is a tiny bit unclear, but, IMO, it makes no
>> sense to include both of them. The whole point of
>> ResponseBuilder.entity(Object, Annotation[]) is so that you can
>> exclusively provide the annotations attached to the entity.
>
> We talked with Marek a lot about it, well, the rules are that
> ResponseBuilder.entity method appends Annotations, and
> ContainerResponseFilter replaces them, is that perfect, I'm not sure,
> but I don't mind :-).
>

I *DO* mind.

Marek is absolutely wrong for taking this stance. With Marek's
interpretation, you cannot override settings on the method. For
example, maybe you are implementing an interface and want to override
the entity annotations on that interface.


-- 
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com