Timothy Larson wrote:

If I request a page where the pipeline encounters an error (e.g. file not found) then the handle-errors pipeline is invoked. However, when I request the same page from the flow with cocoon.sendPageAndWait("somepage"); the handle-errors pipeline is not invoked and no exception is thrown either.

Can anyone else confirm this?



Error-handlers are not invoked on internal requests, which is what the flow uses behind sendPage[AndWait](). In that case, the exception are propagated.


Internal requests are created in 2 circumstances :
- use of SitemapSource: SourceResolver.resolveURI("cocoon:/blah")
- use of internal redirects: <map:redirect-to uri="cocoon:/blah"/> or Redirector.redirect("cocoon:/blah")


The flow uses an internal redirect to handle an external request. This means that the propagated exception is only catched by the top-level Cocoon object which outputs the default error page (if configured to do so). So we can say that the behaviour of not executing error handlers for internal requests is not suitable for internal redirects.

There are 2 solutions to solve this :
1/ apply the same policy for internal redirects than the one that was active before the redirect (i.e. handle errors on internal redirects resulting from external requests)
2/ let the user choose the behaviour through the a new attribute such as handle-internal="true" on <handle-errors>.


Thinking further, these 2 solutions are complementary if we consider that 2/ applies only to internal requests produced by the SitemapSource.

What do you think ?

Sylvain

--
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com




Reply via email to