[Seaside-dev] WAComboResponse + Zinc
Ken Treis
ken at miriamtech.com
Fri Jan 11 06:03:33 UTC 2013
OK Sven, look at Zinc-Seaside-KenTreis.36.1 and let me know what you think. I saved it on a branch so that others will (hopefully) recognize it as "not yet Sven-approved". Some notes/thoughts:
1. I didn't end up needing the useConnection: hook, I latched into ZnResponse>>writeOn: instead. My new ZnSeasideResponse class could perhaps have been called ZnDeferredResponse or ZnLazyResponse. Really, WAComboResponse does all of the work.
2. I grouped the native ZnRequest together with its stream in a new class (ZnSeasideRequest). It's nothing more than a tuple, and I used it because it made everything fit into the WAServerAdaptor framework a little more gracefully. Originally, I tried passing the stream along in a separate argument (contextFor:stream:, responseFor:stream:, etc) but that made everything more cluttered.
3. I had to change WAComboResponse>>binary to use a GRCountingStream. I think this may have just been missed during the original refactoring. This is the only change in Seaside-Core-KenTreis.784.
As a quick test, I put together a component like this:
> 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 ]
It worked as expected, with chunks sent to the browser incrementally.
--
Ken Treis
Miriam Technologies, Inc.
More information about the seaside-dev
mailing list