cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bertrand Delacretaz <bdelacre...@apache.org>
Subject Re: Return Error Code Based on Pipeline Content
Date Mon, 10 Apr 2006 06:34:32 GMT
Le 10 avr. 06 à 04:51, Daniel Curran a écrit :

> ...What I would like to be able to do is examine the content of the  
> sql transform and determine a success or failure of the operation.  
> Based on this result I would like to be able to send an error.
>
> If the operation was completed successfully I would like to send a  
> 200 status code, where as a failure might return a 500...

IMHO the clean way of doing this is to throw an Exception at the  
point where the success/failure decision is made, and use map:handle- 
errors with an ExceptionSelector to set the HTTP status code (See the  
errorhandling samples, http://cocoon.zones.apache.org/demos/release/ 
samples/errorhandling/).

I don't think there is a standard way of throwing Exceptions from  
XSLT code, but calling a small Java extension class from XSLT to  
throw the Exception should do the trick, if you need to do this from  
XSLT.

-Bertrand
Mime
View raw message