[Seaside] ZnZincStreamingServerAdaptor

Sven Van Caekenberghe sven at stfx.eu
Tue Jan 15 11:38:27 UTC 2013


Ken Treis did a beautiful hack and added a ZnZincStreamingServerAdaptor to Zinc-Seaside.

This WAServerAdaptor and subclass of ZnZincServerAdaptor relies on WAComboResponse to generate a response in a streaming fashion (more specifically using chunked transfers for indeterminate sized responses).

Here is Ken's example:

> renderContentOn: html
> 	html heading: 'Stream Test'.
> 	(1 to: 5)
> 		do: [ :i | 
> 			html
> 				paragraph: [ 
> 					html
> 						text: i;
> 						text: '. Each of these paragraphs should appear a few seconds apart.'.
> 					self requestContext response flush ] ]
> 		separatedBy: [ (Delay forSeconds: 2) wait ]

For certain use cases, this is a very important feature to have.

Feel free to test this new adaptor and don't hesitate to give feedback and/or help improve it.

Thanks a lot, Ken !


PS: It is worth noting that with the WAComboResponse the whole responsibility to generate the response is no longer with Zinc but with WAComboResponse as it writes on the raw stream itself, the status line, the headers and body chunks.

Sven Van Caekenberghe
Smalltalk is the Red Pill

More information about the seaside mailing list