[Seaside-dev] Why does WABufferedResponse need a ReadWriteStream?

Lukas Renggli renggli at gmail.com
Tue Jan 27 07:06:15 UTC 2009


> WABufferedResponse (a subclass of WAResponse) is documented to use a
> WriteStream (see the class comments), but the initialize method suggests
> that a ReadWriteStream is needed. As far as I can tell from reading the
> code, the use case is to write things to the response (generally using
> #'nextPutAll:' in WAResponse), and then gather up all the contents at once.

The read-write behavior was used in previous versions, so that the
server adaptor could just reset the stream and encode the contents
before writing it to the socket. I don't think this behavior is still
used by any of the server adapters in Squeak, so the name
WAPlatform>>#readWriteStream is rather wrong. It should be more
something like #binaryAsciiWriteStream.

As you can read in the thread "encoded stream" we are about to replace
that stream with a custom stream anyway, one that will be able to do
the necessarily conversions and encodings on the fly. In fact I've
already written that class and I am just waiting to see how we want to
do the encoding (which is obviously a mess). This custom stream is
setup with plain WriteStream, it only calls methods as tested by
WAPlatformTest, and should therefore work for you out of the box.

> I can imagine that someone might value a more complex object when something
> simple would do instead, but my values tend to go the other direction.

The read write stream made things simpler in previous versions,
because the server adaptor could just read from the previously written
stream without converting it to a different object. As I said, this is
probably not needed anymore and also not very nice, because it can be
done on the fly and no second reading pass is necessary.

Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the seaside-dev mailing list