cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "John L. Webber" <John.Web...@jentro.com>
Subject Re: Can I throw my own ApplicationException from XSP file ?
Date Thu, 16 Sep 2004 07:05:06 GMT
Hello Mariusz,

Yes, you can. You need to have an exception element in the exception 
selector element for each custom exception type you throw:

  <map:selector logger="navigation.sitemap.selector.exception"
                     name="exception" 
src="org.apache.cocoon.selection.ExceptionSelector">
         <exception class="com.mycompany.FooException"
                    name="foo-exception"
                    unroll="true"/>
...

and then in the map:handle-errors something like:

           <map:handle-errors>
             <map:select type="exception">
               <map:when test="foo-exception">
                 <map:generate src="fooerror.xsp" type="serverpages"/>
             <map:transform type="cinclude"/>
             <map:transform src="html/site2html.xsl">
               <map:parameter name="language" value="de"/>
               <map:parameter name="pageTitle" value=": Sorry - Foo 
Exception!"/>
               <map:parameter name="httpPrefix" 
value="{global:http}{request:contextPath}"/>
               <map:parameter name="httpsPrefix" 
value="{global:https}{request:contextPath}"/>
             </map:transform>
             <map:transform type="i18n">
               <map:parameter name="locale" value="de"/>
             </map:transform>
             <map:serialize status-code="500"/>
           </map:when>

Hope that helps,

John


Mariusz Wójcik wrote:
> Hi
> 
> Can I throw my own ApplicationException from XSP file ? I'd like to 
> throw it, and catch it in pipeline by using <map:handle-errors> 
> component. Every time I got message "Unhalted Exception ....". What I 
> should do ? It is possible to do ?
> Thanks for help
> mario
> 

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


Mime
View raw message