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.


Carsten

Open Source Group                        sunShine - b:Integrated
================================================================
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
www.sundn.de                          mailto: [EMAIL PROTECTED]
================================================================


>>>>>>

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:aggregate>
and
    <map:handle-errors>
        <map:transform src="stylesheets/system/error2html.xsl"/>
        <map:serialize status-code="500"/>
    </map:handle-errors>

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:handle-errors>
        <map:redirect-to uri="errorpage"/>
    </map:handle-errors>
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.tomcat.facade.HttpServletResponseFacade.sendError(HttpServletResp
onseFacade.java:204)
    at
org.apache.tomcat.facade.HttpServletResponseFacade.sendRedirect(HttpServletR
esponseFacade.java:230)
    at
org.apache.cocoon.environment.http.HttpResponse.sendRedirect(HttpResponse.ja
va:84)
    at
org.apache.cocoon.environment.http.HttpEnvironment.redirect(HttpEnvironment.
java:106)
    at
org.apache.cocoon.www.sitemap_xmap.error_process_1(sitemap_xmap.java:5035)
    at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:5003)
    at org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1245)
    at org.apache.cocoon.sitemap.Handler.process(Handler.java:175)
    at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:94)
    at org.apache.cocoon.Cocoon.process(Cocoon.java:293)
    at
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:471)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    (...)

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?

Thanx,

Jan

___________________________________________________


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 - www.the-ecorp.com
<<<<<<<


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to