Server streams proposals has been edited by Julien Vermillard (Aug 10, 2008).

Change summary:

streaming proposal

(View changes)

Content:

Sending HTTP response in chunk in place of a big IoBuffer

Actually a asyncweb response content is one big IoBuffer, is quite inefficient and prevent serving big content or long streaming.

I'm trying to find a good API since a moment, but it's not very easy (specially with dealing with IoBuffer) so here my proposal, which normally won't break the current API :

It's adding extra possibility to

HttpContext.commit(..);

You can commit a ChunkedHttpResponse and infinite number of HttpContentChunk :

context.commit(chunkedResponse);
context.commit(chunk1);
context.commit(chunk2);
context.commit(chunk3);

When it's done you provide a HttpContentChunk with the attribute endOfContent at true, so Asyncweb close the session.

context.commit(new DefaultHttpContentChunk(dataBuffer, true, chunkedResponse) );
  1. it's simple
  2. you are free to feed httpContext with another thread or from anywhere else.
  3. each chunk got a reference to the main HttpChunkResponse, so filters like GZipFilter will be able to work on streams (with some modifications).

Reply via email to