Re: JSR311: Problem with StreamedOutput model

From: Stephan Koops <>
Date: Fri, 14 Mar 2008 14:28:07 +0100

Hello Bill,

why must the MessageBodyWriter (or the StreamingOutput) blocks, why not
the resource method?
This brings application logic in the MessageBodyWriter. But this is not
the business of the MessageBodyWriter, as its name says.

If the resource method blocks, than it is also not necessary, that the
MessageBodyWriter throws Exceptions or changes HTTP headers.

best regards

Bill Burke schrieb:
> Jerome Louvel wrote:
>> Hi Bill,
>> My understanding of AJAX polling is that you don't have a pending HTTP
>> request running waiting for some potential content. It is that the AJAX
>> client regularly sends a HTTP request to the server to look for new
>> events.
>> In this scenario, we could take advantage of conditional GETs to
>> optimize
>> response times.
> That wasn't my understand. My understanding was that the AJAX GET
> would block for a certain amount of time waiting for a response.
> Otherwise, you're not really reducing the amount of requests.
>> Maybe you are referring to the Comet style? Here the post defining
>> Comet:
>> Anyway, in both cases, I don't see how deferring the response
>> status/headers
>> writing would really help. Could you explain?
> What I mean is, the StreamedOutput implementation might want to wait
> from input from another place (chat, JMS, whatever), if the timeout
> fails, then send a REQUEST_TIMEOUT as the response.
>> Also, I don't think that JAX-RS should aim at supporting the Comet
>> style, at
>> least not initially.
> Yeah, you're right that it doesn't solve the polling problem. We'd
> need a specific contract for that. Still, if dynamic streamed data
> needs to be done in a callback object, the callback object needs to be
> able to report errors.
> Bill