dev@jsr311.java.net

Re: ProduceMime and ConsumeMime

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Mon, 09 Apr 2007 11:40:15 -0400

On Apr 9, 2007, at 11:23 AM, Julian Reschke wrote:

> Paul Sandoz schrieb:
>> ...
>> That i why the names of the annotation are Consume/ProduceMime
>> (although Consume/ProduceMedia would be better). If a POJO that
>> is a resource is annotated it says that all HTTP methods of that
>> resource are capable of consuming or producing the media types
>> declared by those annotations. The annotations on the method
>> override those of the class.
>> ...
>
> Does that mean that there is an assumption that the set of
> acceptable media types is independant of the method? I think that
> would be a problem (consider a server that accepts any media type
> for PUT, but only one specific diff format for PATCH).
>
Right. The thinking is that if you have a lot of methods with common
media type characteristics you can put the annotations at the class
level and then only override them for individual methods that differ.
If you only have a couple of methods in total and they are different
you can just put the annotations at the method level since class
level annotations won't save anything.

Marc.

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