cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <>
Subject AW: [C2] handle-errors with content aggregation
Date Thu, 12 Jul 2001 07:25:16 GMT
With the current design of cocoon2 it is not possible to have always a
clean error page.
The problem is that the components, e.g. the content aggregation write
directly to the output stream. If some components have written something
and an error occurs it is forbidden by the servlet engine to do a redirect
and the output stream cannot be reset.

I wanted to address this problem by the concept of an intermediate output
stream, but there is currently no consense found.


Open Source Group                        sunShine - b:Integrated
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn                          mailto:


Hi all,

I'm currently working on a site that frequently uses content aggregation.
But when an error occurs, I should be able to show a nice error page, not
the standard cocoon error page. So now I'm trying to use the handle-errors
for this purpose, but I have some problems when an error occurs in a part of
a aggregated page.

An example:
    <map:aggregate element="page">
        <map:part src="header.xml" element="header"/>
        <map:part src="left.xml" element="left"/>
        <map:part src="middle.xml" element="middle"/>
        <map:part src="footer" element="footer"/>
        <map:transform src="stylesheets/system/error2html.xsl"/>
        <map:serialize status-code="500"/>

When an error occurs while generating the part middle.xml, I get a page
containing header, left and the (transformed) cocoon error, but no footer.
This is not exactly what I want, so I tried a redirect to a static error
page inside the handle-errors block:
        <map:redirect-to uri="errorpage"/>
This doesn't work either, I get:
    DEBUG   64521   [cocoon  ] (Thread-6): Sitemap: session='false',
redirecting to 'errorpage'
    DEBUG   64521   [cocoon  ] (Thread-6): Sending redirect to 'errorpage'
    ERROR   64521   [cocoon  ] (Thread-6): error notifier barfs
    java.lang.IllegalStateException: Response has already been committed
    at org.apache.cocoon.www.sitemap_xmap.process(
    at org.apache.cocoon.www.sitemap_xmap.process(
    at org.apache.cocoon.sitemap.Handler.process(
    at org.apache.cocoon.sitemap.Manager.invoke(
    at org.apache.cocoon.Cocoon.process(
    at javax.servlet.http.HttpServlet.service(

which makes sense, as my header part and left part of the aggregation have
already been committed, right?

So I can't redirect here, because I'm handling errors in one part of my
aggregation, and the first two parts have already been committed.
But if I handle errors of a part of the aggregation, and of the aggregation
itself, then why isn't the last part of the aggregation displayed?
And what can I do to simple show an error page, without any remaining
aggregation parts?

Any suggestions?




Jan Uyttenhove
- Software Engineer -

The E-corporation
Roderveldlaan 3 bus 1
B-2600 Antwerpen

Guldensporenpark 10 (Axxes 51-003)
B-9820 Merelbeke-Gent

T:+32 [0]9 272.22.00
F:+32 [0]9 272.22.11
- Good company for the road ahead -

To unsubscribe, e-mail:
For additional commands, email:

View raw message