dev@jsr311.java.net

Re: ProduceMime and ConsumeMime

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 09 Apr 2007 17:41:24 +0200

On Apr 9, 2007, at 5:23 PM, 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).
>

An example might help in addition to Marc's response:

class WebDavResource {
     @HttpMethod
     void putThingy(Entity<byte[]> thingy) { ... }


     @HttpMethod("PROPPATCH")
     @ConsumeMime("text/xml")
     @ProduceMime("text/xml")
     MultiStatusBean patchThingy(PropertyUpdateBean pub) { ... }

}

If no Consume/ProduceMime is associated with a method then it can
consume/produce anything i.e. */*.

Paul.