You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by ni...@planet.nl on 2008/04/03 15:56:09 UTC

[2.1] Handling errors in sub sitemap

I've tried following the explanation on handling errors with cocoon [1], but I can't get it working like I expect.

I've a main sitemap in which sits a pipeline:

            <map:match pattern="external/**">
                <map:mount src="site://external/sitemap.xmap" uri-prefix="external" />
            </map:match>

And I have a external/sitemap.xmap which contains:

            <map:match pattern="data">
                <map:generate src="repository:default://data/messages.xml" />
                <map:transform src="site://transformers/external/data.xsl" />
                <map:serialize type="xml" />
            </map:match>

This site map can throw a java.net.MalformedURLException inside a ProcessingException. So I've created a selector:
    <map:components>
        <map:selectors>
            <map:selector name="exception" src="org.apache.cocoon.selection.ExceptionSelector">
                <exception name="processing" class="org.apache.cocoon.ProcessingException" unroll="true" />
                <exceptions name="malformedurl" class="java.net.MalformedURLException" />
            </map:selector>
        </map:selectors>
    </map:components>

I tried putting the selector inside the subsitemap and created a handle-errors:
            <map:handle-errors>
                <map:select type="exception">
                    <map:when test="processing">
                        <map:generate src="resource://processing.xml" />
                        <map:serialize type="xml" />
                    </map:when>
                    <map:when test="malformedurl">
                        <map:generate src="resource://malformedurl.xml" />
                        <map:serialize type="xml" />
                    </map:when>
                </map:select>
            </map:handle-errors>

This piece I tried putting inside the <pipeline> that contains the data matcher and inside the <pipelines> element that contains the data matcher. This two options didn't work. Then I tried putting the selector and the handle errors in the <pipelines> element which contains my mount part. And there it only handled the ProcessingException part and not the malformed url part.

I'm using Cocoon 2.1.11.

Can errors be handled in the sitemap where they are generated, even though the sitemap is mounted?
Why is my processingexception not being unrolled?

Hope someone can help,

Nick S.

[1] http://cocoon.apache.org/2.1/userdocs/concepts/errorhandling.html

RE: [2.1] Handling errors in sub sitemap

Posted by ni...@planet.nl.
Nabble didn't send my attachment, so here it is.

With regards,

Nick S.

-----Original Message-----
From: Nick Stolwijk [mailto:nicklist@planet.nl]
Sent: Mon 4/14/2008 12:55
To: users@cocoon.apache.org
Subject: Re: [2.1] Handling errors in sub sitemap
 

Ok, I've taken the samples, but I still can't find out what I'm doing wrong.

What I did:

Checkout samples and got it running.
I made a few changes (see attachment) and opened
http://localhost/samples/errorhandling/sax

Expected:

A cought sax exception by this errorhandler:
      <map:handle-errors>
        <map:select type="exception">
          <map:when test="sax">
            <map:generate src="notFound.html"/>
            <map:serialize/>
          </map:when>
        </map:select>
      </map:handle-errors>  

What I got: the default error page.

What am I doing wrong?

With regards,

Nick S.

I have adjusted the 

Vadim Gritsenko wrote:
> 
> On Apr 9, 2008, at 4:55 PM, Grzegorz Kossakowski wrote:
>> Nick Stolwijk pisze:
>>> Can someone help me with this? The documentation doesn't seem to  
>>> reflect the
>>> current behaviour and I can't find any other postings about this.
>>
>> Hi Nick,
>>
>> I'm not the expert on handling errors in sitemaps so can't give you  
>> any quick advice. However, if you could prepare some minimal sample  
>> that I could quickly run in C2.1 then I could have a debugging  
>> session over the weekend and most probably come with some conclusion.
>>
>> BTW. I believe that error handling in mounted sitemaps should work  
>> just fine.
> 
> There is also a fairly comprehensive set of sitemap error handling  
> samples (2.1 and 2.2 links):
> http://svn.apache.org/repos/asf/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/errorhandling/
> http://svn.apache.org/repos/asf/cocoon/trunk/blocks/cocoon-core-sample/cocoon-core-main-sample/src/main/resources/COB-INF/errorhandling/
> 
> Nick, please take a look if you have not see them yet.
> 
> Vadim
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-2.1--Handling-errors-in-sub-sitemap-tp16475316p16676070.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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





Re: [2.1] Handling errors in sub sitemap

Posted by Nick Stolwijk <ni...@planet.nl>.
Ok, I've taken the samples, but I still can't find out what I'm doing wrong.

What I did:

Checkout samples and got it running.
I made a few changes (see attachment) and opened
http://localhost/samples/errorhandling/sax

Expected:

A cought sax exception by this errorhandler:
      <map:handle-errors>
        <map:select type="exception">
          <map:when test="sax">
            <map:generate src="notFound.html"/>
            <map:serialize/>
          </map:when>
        </map:select>
      </map:handle-errors>  

What I got: the default error page.

What am I doing wrong?

With regards,

Nick S.

I have adjusted the 

Vadim Gritsenko wrote:
> 
> On Apr 9, 2008, at 4:55 PM, Grzegorz Kossakowski wrote:
>> Nick Stolwijk pisze:
>>> Can someone help me with this? The documentation doesn't seem to  
>>> reflect the
>>> current behaviour and I can't find any other postings about this.
>>
>> Hi Nick,
>>
>> I'm not the expert on handling errors in sitemaps so can't give you  
>> any quick advice. However, if you could prepare some minimal sample  
>> that I could quickly run in C2.1 then I could have a debugging  
>> session over the weekend and most probably come with some conclusion.
>>
>> BTW. I believe that error handling in mounted sitemaps should work  
>> just fine.
> 
> There is also a fairly comprehensive set of sitemap error handling  
> samples (2.1 and 2.2 links):
> http://svn.apache.org/repos/asf/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/errorhandling/
> http://svn.apache.org/repos/asf/cocoon/trunk/blocks/cocoon-core-sample/cocoon-core-main-sample/src/main/resources/COB-INF/errorhandling/
> 
> Nick, please take a look if you have not see them yet.
> 
> Vadim
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/-2.1--Handling-errors-in-sub-sitemap-tp16475316p16676070.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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


Re: [2.1] Handling errors in sub sitemap

Posted by Vadim Gritsenko <va...@reverycodes.com>.
On Apr 9, 2008, at 4:55 PM, Grzegorz Kossakowski wrote:
> Nick Stolwijk pisze:
>> Can someone help me with this? The documentation doesn't seem to  
>> reflect the
>> current behaviour and I can't find any other postings about this.
>
> Hi Nick,
>
> I'm not the expert on handling errors in sitemaps so can't give you  
> any quick advice. However, if you could prepare some minimal sample  
> that I could quickly run in C2.1 then I could have a debugging  
> session over the weekend and most probably come with some conclusion.
>
> BTW. I believe that error handling in mounted sitemaps should work  
> just fine.

There is also a fairly comprehensive set of sitemap error handling  
samples (2.1 and 2.2 links):
http://svn.apache.org/repos/asf/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/errorhandling/
http://svn.apache.org/repos/asf/cocoon/trunk/blocks/cocoon-core-sample/cocoon-core-main-sample/src/main/resources/COB-INF/errorhandling/

Nick, please take a look if you have not see them yet.

Vadim

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


Re: [2.1] Handling errors in sub sitemap

Posted by Grzegorz Kossakowski <gr...@tuffmail.com>.
Nick Stolwijk pisze:
> Can someone help me with this? The documentation doesn't seem to reflect the
> current behaviour and I can't find any other postings about this.
> 
> With regards,

Hi Nick,

I'm not the expert on handling errors in sitemaps so can't give you any quick advice. However, if 
you could prepare some minimal sample that I could quickly run in C2.1 then I could have a debugging 
session over the weekend and most probably come with some conclusion.

BTW. I believe that error handling in mounted sitemaps should work just fine.

-- 
Grzegorz Kossakowski

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


Re: [2.1] Handling errors in sub sitemap

Posted by Nick Stolwijk <ni...@planet.nl>.
Can someone help me with this? The documentation doesn't seem to reflect the
current behaviour and I can't find any other postings about this.

With regards,

Nick Stolwijk


Nick Stolwijk wrote:
> 
> I've tried following the explanation on handling errors with cocoon [1],
> but I can't get it working like I expect.
> 
> I've a main sitemap in which sits a pipeline:
> 
>             <map:match pattern="external/**">
>                 <map:mount src="site://external/sitemap.xmap"
> uri-prefix="external" />
>             </map:match>
> 
> And I have a external/sitemap.xmap which contains:
> 
>             <map:match pattern="data">
>                 <map:generate src="repository:default://data/messages.xml"
> />
>                 <map:transform src="site://transformers/external/data.xsl"
> />
>                 <map:serialize type="xml" />
>             </map:match>
> 
> This site map can throw a java.net.MalformedURLException inside a
> ProcessingException. So I've created a selector:
>     <map:components>
>         <map:selectors>
>             <map:selector name="exception"
> src="org.apache.cocoon.selection.ExceptionSelector">
>                 <exception name="processing"
> class="org.apache.cocoon.ProcessingException" unroll="true" />
>                 <exceptions name="malformedurl"
> class="java.net.MalformedURLException" />
>             </map:selector>
>         </map:selectors>
>     </map:components>
> 
> I tried putting the selector inside the subsitemap and created a
> handle-errors:
>             <map:handle-errors>
>                 <map:select type="exception">
>                     <map:when test="processing">
>                         <map:generate src="resource://processing.xml" />
>                         <map:serialize type="xml" />
>                     </map:when>
>                     <map:when test="malformedurl">
>                         <map:generate src="resource://malformedurl.xml" />
>                         <map:serialize type="xml" />
>                     </map:when>
>                 </map:select>
>             </map:handle-errors>
> 
> This piece I tried putting inside the <pipeline> that contains the data
> matcher and inside the <pipelines> element that contains the data matcher.
> This two options didn't work. Then I tried putting the selector and the
> handle errors in the <pipelines> element which contains my mount part. And
> there it only handled the ProcessingException part and not the malformed
> url part.
> 
> I'm using Cocoon 2.1.11.
> 
> Can errors be handled in the sitemap where they are generated, even though
> the sitemap is mounted?
> Why is my processingexception not being unrolled?
> 
> Hope someone can help,
> 
> Nick S.
> 
> [1] http://cocoon.apache.org/2.1/userdocs/concepts/errorhandling.html
> 
> 

-- 
View this message in context: http://www.nabble.com/-2.1--Handling-errors-in-sub-sitemap-tp16475316p16548548.html
Sent from the Cocoon - Users mailing list archive at Nabble.com.


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