Page Buffering

The HTML response generated by a page during rendering is buffered. Eight kilobytes of 8-bit ASCII HTML is allowed to accumulate before any HTML output is actually sent back to the client web browser.

If a Java exception is thrown during the page rendering process, any buffered output is discarded, and the application-defined exception page is used to report the exception to the user.

If a page generates a large amount of HTML (larger than the 8KB buffer) and then throws an exception, the exception page is still used to report the exception, however the page finally viewed in the client browser will be "ugly", because part of the failed page's HTML will appear, then the complete HTML of the exception page.

In practice, virtually all Tapestry pages will use a Body component wrapping the majority of the page (it takes the place of the normal <body> element), and a Body component buffers the output of all components in its body. This buffering is necessary so that the Body component can write out various JavaScript handlers before the main body of HTML is written (this is often related to the use of the Rollover and Script components).

In any case, whenever a Body component is used, an exception thrown during the rendering of the page will cause all the HTML buffered by the Body component to be cleanly discarded, allowing for a clean presentation of the exception page.