[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xml-cocoon-users
Subject:    Re: Return Error Code Based on Pipeline Content
From:       Bertrand Delacretaz <bdelacretaz () apache ! org>
Date:       2006-04-10 6:34:32
Message-ID: 1E4BCBE1-306B-440A-AA3B-F2FA8B93CA4F () apache ! org
[Download RAW message or body]


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
["smime.p7s" (application/pkcs7-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic