cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: error handling across recursive pipeline calls? (repost)
Date Tue, 13 Jan 2004 23:31:50 GMT
AFAIK it's not that easy. Maybe somebody else can correct me, but an 
internal cocoon:/ request is handled the same way an external request is 
handled. I.e. a pipeline is searched for it and if non is found (that's 
the case for your failing action) an error is thrown. This is caught by 
an error handler, if there is one. But the error is not given to the 
outer pipeline. You can try to return only an XML structure from the 
error handler from the internal request and handle this one in a normal 
way in the outer pipeline (no error handler involved).

Joerg

On 12.01.2004 23:39, Lars Huttar wrote:

> Hi all,
> Reposting, in hopes of somebody offering an answer...
> 
> I've been struggling with some error handling issues for several
> days now. Perhaps the key to my problems can be found in the answer
> to the question, can errors propagate beyond a pipeline call?
> 
> E.g. if I have the following pipeline:
> 
>       <!-- role-specific index to the contents of the named system. -->
>       <map:match pattern="*/*/index"> <!-- {1} is systemName, {2} is role -->
>         <map:generate src="cocoon:/protected/{1}/{2}/index.xsp" label="raw" />
>         <map:transform src="format/index-page.xsl" />
>         <map:serialize type="html" />
>       </map:match>
> 
> It does a recursive call to another (internal) pipeline, protected/...
> That pipeline, in the same sitemap, looks like this:
> 
>       <!-- authorize access to protected xsp pages. -->
>       <map:match pattern="protected/*/*/**.xsp">  <!-- {1} is systemName, {2}
is role, {3} is xsp
> file name -->
>         <map:act type="xsp-action" src="cocoon:/authorize/{1}/{2}">
>           <map:generate src="systems/{../1}/{../2}/{../3}.xsp" type="serverpages"
/>
>         </map:act>
>         <map:serialize />
>       </map:match>
> 
> Which recursively calls a third pipeline (which generates an XSP page
> which is run by the second pipeline).
> 
> Naturally the "protected" pipeline (the second one) is used by several
> different user-accessible pipelines (like the first one above) to access
> various XSP files, subject to authorization. If the authorization fails,
> I want the xsp-action running "authorize" to generate an error that jumps
> out of the *outer* pipeline
> and is caught by an error handler at the outer level, which can output
> an "Access denied" message formatted in HTML.
> Is this possible?
> I have tried doing it several different ways, and so far all have failed.
> I could write pages on what I have tried and what the results were, but I'd
> just like to know if I'm totally barking up the wrong tree.
> 
> I will say that I started with a sitemap-global error handler (outside all
> pipelines), then I decided it was better to have the error handler inside
> the non-internal pipeline. (That way, the error occurring in the internal
> pipeline hopefully would not be caught until it reached the outer pipeline.)
> 
> Thanks,
> Lars



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message