Streaming HTML generation

Mark Friedman writes:
 > Is there a way to use the HTMLGenerator class to stream HTML back to a
 > browser. i.e. return the HTML as it's generated instead of waiting until it's
 > all generated?

The current HTML generator doesn't support this, it's probably its
worst drawback (ie this will soon reach top prority :-)

 > If not, is there any way to do it?

The most simple way is to define a new subclass of InputStream, that
creates the output on demand when its read method is called
(SSIResource uses such a trick, as does CgiResource - in some sense).

A much less efficient way is to use PipedStream (avoid them as much as
possible - at least the java.io impl, they are really slow).

If any of the above doesn't match your needs, let me know

Anselm.
BTW: ResourceStore API *is* changing, not up to what we have discussed
yet, but enough to make it possible (more on this latter)

Received on Thursday, 26 December 1996 03:43:50 UTC