users@jsr311.java.net

Re: MessageBodyWriter and annotations

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 01 Jul 2008 11:26:18 -0400

On Jun 30, 2008, at 4:27 PM, Bill Burke wrote:
>>>
>> @GET @Path("foo")
>> public SomeType getSomething() {...}
>> If we pass annotations on the method (getSomething) rather that the
>> type (SomeType), the MessageBodyWriter will get an array [GET,
>> Path]. Its not a huge deal, just there's no way to annotate the
>> return type separately from the method so the JX-RS annotations on
>> the method will be included.
>
> Not a big deal, IMO. You might actually have different annotations
> on the same method that are consumed by different MessageBodyWRiters
> depending on the response content-type.
>
OK, I'll clarify the javadoc along these lines. In the future if it
becomes possible to annotate the return type separate from the method
then we can add both sets of annotations together to retain backwards
compatibility. This should work provided a particular annotation
doesn't have a different meaning when applied to a return type or
method.

Marc.

---
Marc Hadley <marc.hadley at sun.com>
CTO Office, Sun Microsystems.