users@jsr311.java.net

Re: time to call MessageBodyReader

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Fri, 04 Apr 2008 10:17:52 -0400

On Apr 4, 2008, at 9:48 AM, Stephan Koops wrote:
>
> the method readFrom requires the type to convert to and the
> annotations from the (sub) resource method. So the runtime
> environment can call the MessageBodyWriter not until the resource
> method was found. But then the root resource class constructor and
> the resource locators gets perhaps different headers, because the
> MessageBodyReader may change them.
> Did you had this in mind?
>

I don't recall now why the headers supplied to a MessageBodyReader are
mutable ? It makes sense for writers but seems to me that headers in a
reader could be read-only.

If there's a good reason to have mutable headers in a reader then I
propose that the reader should be invoked after the resource class
constructor is called (for consistency between root resources and sub-
resources) but before the values of any other method parameters are
extracted.

Marc.

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