Re: ProduceMime and ConsumeMime

From: Dhanji R. Prasanna <>
Date: Tue, 10 Apr 2007 09:15:17 +1000

On 4/9/07, Marc Hadley <> wrote:
> On Apr 7, 2007, at 1:21 AM, Dhanji R. Prasanna wrote:
> >
> >
> Requiring JSR 308 would tie us to Java SE 7 which I think would be a
> mistake. Allowing it as an alternative might be OK. I'm curious
> though whether the above is any more expressive/desirable than:
> @HttpMethod
> @MediaType("text/xml")
> public Respresentation<String> getString(@MediaType("text/plain")
> String text)

I certainly like this, I was just thinking aloud wrt annotating the generic
type--it was more a question of trying to indicate metadata on the return
TYPE rather than the method itself. But on consideration that is not a
particularly more elegant option.

or even
> @HttpMethod
> @ProduceMime("text/xml")
> @ConsumeMime("text/plain")
> public Respresentation<String> getString(String text)

The reason I prefer the parameter annotation is that we can support
injection of other resources (i.e. RequestContext--discussd in another
thread) to the method in additional parameters (and so the order of formal
parameters becomes unimportant). Beyond that, @Produce and @Consume are
clear enough.