Re: JSR311: Response isn't adequate

From: Marc Hadley <Marc.Hadley_at_Sun.COM>
Date: Tue, 04 Mar 2008 17:34:36 -0500

On Mar 4, 2008, at 5:13 PM, Bill Burke wrote:
> Marc Hadley wrote:
>> On Mar 4, 2008, at 1:26 PM, Bill Burke wrote:
>>> Marc Hadley wrote:
>>>> How does the following sound:
>>>> public interface StreamingOutput {
>>>> OutputStream getOutputStream(int status, MultivaluedMap<String,
>>>> Object> metadata);
>>>> }
>>> I'm wondering if MessageBodyWriters should follow the same sort of
>>> contract as they have the same "commit" ordering problem, don't
>>> they?
>> You mean split the writeTo into two methods, e.g. writeMetadata +
>> writeBody ?
> No. I mean
> writeTo(T t, MediaType type, StreamingOutput output);
I don't like that much, I think the use of Response in message body
readers and writers would complicate things rather than simplify.

>> I don't know if that is really necessary, I tried to capture the
>> need to update headers first in the existing javadoc, IMO that
>> should be sufficient.
> If Javadoc is sufficient for MessageBodyWriter, then why not have a
> OutputStream getOutputStream() method on Response? Sure, you'd have
> to tunnel the OutputStream and header processing through a
> ThreadLocal, but the API would be simpler and consistent.
I don't think that would work since Response can be implemented by an
application class, its not just something you can get from a response

> Just some thoughts...
Understood. Can you live with the proposal as-is ?


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