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

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

From: Sergey Beryozkin <sberyozkin_at_talend.com>
Date: Mon, 20 May 2013 09:59:27 +0100

On 17/05/13 15:45, Bill Burke wrote:
>
>
> 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.
I would not worry about it now to be honest. Either action (replacing or
appending to the annotations) can be done from a filter, which is really
where this rather specific operation has to be done anyway, not in the
application code, so I'm fine with Marek preferring ResponseBuilder
appending, it does not really matter given the filter options, as far as
I'm concerned :-)

Cheers, Sergey
>
>