Re: JSR311: Problem with StreamedOutput model

From: Bill Burke <>
Date: Fri, 14 Mar 2008 09:21:18 -0400

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 Burke
JBoss, a division of Red Hat