Re: JSR311: Problem with StreamedOutput model

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Fri, 14 Mar 2008 11:03:42 -0400

On Mar 14, 2008, at 10:15 AM, Stephan Koops wrote:
> BTW: Is there any use case where it is needed to add the headers in
> the MessageBodyWriter and not in the reader?

I can imagine use-cases where its desirable. I think it would usually
be *possible* to set any metadata in the resource method but not
always desirable. Forcing that seems like an artificial restriction on
how an application developer chooses to partition the functionality.
There's no particular benefit to such a restriction so why have it.

>>> But where is it needed in the StreamingOutput? All what I can do
>>> in the StreamingOutput.write(..), what is done before starting the
>>> writing on the output, could be done ahead in the resource method,
>>> by moving it from the beginning of the write method ahead the
>>> creation of it.
>> For StreamingOutput you have no choice, that's a limitation of
>> using that type.
>> If you want full access then you can easily write a message body
>> writer instead.
> The point is, that I never want it ...
That's OK, nobody is forcing you to use it ;-).


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