You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Olivier Billard <ob...@rennes.jouve.fr> on 2004/03/02 18:24:37 UTC

[Portal] Why don't cocoon errors appear in a coplet ?

Hi cocooners !

I posted in the users' but maybe some sitemap gurus can show me the light ;).

I use the portal for a project and i'm not able to display errors in a (main) coplet.
I always have a blank content, as if when rendering the content of the coplet, the error 
content is not put in the whole portal page.

I tried xml-serializing, html-serializing errors :

     <map:handle-errors>
       <map:select type="exception">

         <map:when test="not-found">
           <map:generate type="notifying"/>
           <map:transform src="stylesheets/system/error2html.xslt">
             <map:parameter name="contextPath" value="{request:contextPath}"/>
             <map:parameter name="pageTitle" value="Resource not found"/>
           </map:transform>
           <map:serialize status-code="404"/>
         </map:when>

         <map:when test="invalid-continuation">
           <map:generate src="not-found.xml"/>
           <map:transform src="welcome.xslt">
             <map:parameter name="contextPath" value="{request:contextPath}"/>
           </map:transform>
           <map:serialize status-code="404"/>
         </map:when>

         <map:otherwise>
           <map:generate type="notifying"/>
           <map:transform src="stylesheets/system/error2html.xslt">
             <map:parameter name="contextPath" value="{request:contextPath}"/>
           </map:transform>
           <!--map:serialize status-code="500"/-->
--->      <map:serialize type="html"/>
         </map:otherwise>
       </map:select>

     </map:handle-errors>

(map:otherwise is choosen, i tried renaming the transformer src attribute)

But no way : I have no content in the coplet...
I can right display the error when calling the coplet pipe, but it' empty in the portal 
page...

It seems to work like standard/error output : when an error occurs, the standard sitemap 
output is empty, and the sitemap error output contains the error catched in the 
map:handle-errors.

Thanks in advance for your answers !

-- 
Olivier BILLARD


Re: [Portal] Why don't cocoon errors appear in a coplet ?

Posted by Olivier Billard <ob...@rennes.jouve.fr>.
On 03/03/2004 11:47, Carsten Ziegeler wrote:
> Olivier Billard wrote:
> 
>>For some of our pipelines, we don't use the cocoon protocol, 
>>but just a serverpages generator. Renaming a variable in the 
>>XSP to cause a "Language Exception" page, I still have the 
>>content of the coplet empty (but as before the decoration 
>>remains : <title>My title</title>). And I still have the 
>>"correct" error display when calling directly the coplet pipeline.
>>
>>I added
>>   <attribute>
>>     <name>error-uri</name>
>>     <value
>>       xsi:type="java:java.lang.String"
>>       
>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon:/
>>erreur-coplet</value>
>>   </attribute>
>>
>>in the profiles/copletdata/portal.xml in my coplet and added 
>>a match in the sitemap, in the very beginning to avoid 
>>*/**-like matchings :
>>
>>   <map:match pattern="erreur-coplet">
>>     <map:generate type="notifying"/>
>>     <map:transform src="stylesheets/system/error2html.xslt">
>>       <map:parameter name="contextPath" 
>>value="{request:contextPath}"/>
>>       <map:parameter name="pageTitle" value="Resource not found"/>
>>     </map:transform>
>>   </map:match>
>>
>>but I have the same result : the content of the coplet is 
>>void, and it seems that this pipeline is never called.
>>
> 
> You can't use the "notifying" generator there as this is a new
> pipeline call (internally). So you can e.g. use the file generator
> reading a standard error.xml or something like that. 

ok. I changed the pipeline :
   <map:match pattern="erreur-coplet">
     <map:generate src="not-found.xml"/>
       <map:transform src="welcome.xslt">
         <map:parameter name="contextPath" value="{request:contextPath}"/>
       </map:transform>
   </map:match>

but no progress...

>  
> 
>>But it's right that the portal uses the cocoon protocol to 
>>aggregate the various coplet contents. But why doesn't it 
>>detect map:handle-errors branchings ?
>>
> 
> That's how the cocoon: protocol was designed :) (So, again
> has nothing to do with the portal). Now, I'm not sure, but
> it might be possible to change the code of the portal
> coplet adapter, so that it passes the exception into the
> error pipeline so that you can use the "notifying" generator.
> Might be possible.
woutchou ;) !
That very much work for this handling, don't you think ;) ?
Didn't you experiment such a behaviour, using the portal ? If you cause an error (resource 
not found, language exception, ...) in a coplet, you have a wide-screen cocoon error ? Or 
your "error-uri" attribute pipeline is called for all types of errors ?

When I rename the src of the XSP, the error don't display in the portal, but displays well 
when calling the coplet pipeline directly...

Thanks again for your answers, Carsten !

-- 
Olivier BILLARD


Re: [Portal] Why don't cocoon errors appear in a coplet ?

Posted by Nico Verwer <nv...@be-value.nl>.
Thank you very much for your response, Vadim!
I was unaware of the 'when' attribute on error handlers, which does not 
appear in the (legacy) documentation. After some searching, I found that 
it is in the new documentation (http://cocoon.zones.apache.org/), but 
only in Daisy, not in the HTML export.

Best regards, Nico


> Nico Verwer wrote:
>> Vadim Gritsenko <vadim <at> reverycodes.com> wrote a long, long time 
>> ago:
>>> I think I already heard similar requests in the context of 
>>> aggregator and [c|x]include transformer, so that it would be 
>>> possible to execute included/aggregated pipelines without ignoring 
>>> sitemap error handling. May be internal sitemap processing can be 
>>> made more flexible and allow execution of handle-errors. WDYT?
>> Did anyone actually manage to do this?
>
> Yes.
>
> http://svn.apache.org/repos/asf/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/errorhandling/internal/ 
>
>
> Vadim
>


Re: [Portal] Why don't cocoon errors appear in a coplet ?

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Nico Verwer wrote:
> Vadim Gritsenko <vadim <at> reverycodes.com> wrote a long, long time ago:
> 
>> Carsten Ziegeler wrote:
>>> Olivier Billard wrote: 
>>>  
>>>> But it's right that the portal uses the cocoon protocol to 
>>>> aggregate the various coplet contents. But why doesn't it 
>>>> detect map:handle-errors branchings ?
>>>>
>>> That's how the cocoon: protocol was designed :) (So, again
>>> has nothing to do with the portal).
>>>
>> I think I already heard similar requests in the context of aggregator 
>> and [c|x]include transformer, so that it would be possible to execute 
>> included/aggregated pipelines without ignoring sitemap error handling. 
>> May be internal sitemap processing can be made more flexible and allow 
>> execution of handle-errors. WDYT?
> 
> Did anyone actually manage to do this?

Yes.

http://svn.apache.org/repos/asf/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/errorhandling/internal/

Vadim

Re: [Portal] Why don't cocoon errors appear in a coplet ?

Posted by Nico Verwer <nv...@be-value.nl>.
Vadim Gritsenko <vadim <at> reverycodes.com> wrote a long, long time ago:

> Carsten Ziegeler wrote:
> > 
> >Olivier Billard wrote: 
> >  
> >>But it's right that the portal uses the cocoon protocol to 
> >>aggregate the various coplet contents. But why doesn't it 
> >>detect map:handle-errors branchings ?
> >>
> >That's how the cocoon: protocol was designed :) (So, again
> >has nothing to do with the portal).
> >
> I think I already heard similar requests in the context of aggregator 
> and [c|x]include transformer, so that it would be possible to execute 
> included/aggregated pipelines without ignoring sitemap error handling. 
> May be internal sitemap processing can be made more flexible and allow 
> execution of handle-errors. WDYT?
> 
> Vadim

Did anyone actually manage to do this? At the time, Carsten answered that it
should be possible, but I don't see how one could change the SitemapSource to do
this.
I'll keep trying, but it would help if this has already been done.

Best regards,
Nico Verwer




RE: [Portal] Why don't cocoon errors appear in a coplet ?

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Vadim Gritsenko wrote:
> 
> I think I already heard similar requests in the context of 
> aggregator and [c|x]include transformer, so that it would be 
> possible to execute included/aggregated pipelines without 
> ignoring sitemap error handling. 
> May be internal sitemap processing can be made more flexible 
> and allow execution of handle-errors. WDYT?
> 
Yes, that should be possible. I don't know if it makes sense,
in the most cases where I use internal pipelines for aggregation
it doesn't make sense. But that's just me.

Carsten


Re: [Portal] Why don't cocoon errors appear in a coplet ?

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Carsten Ziegeler wrote:

> 
>Olivier Billard wrote: 
>  
>
>>But it's right that the portal uses the cocoon protocol to 
>>aggregate the various coplet contents. But why doesn't it 
>>detect map:handle-errors branchings ?
>>
>>    
>>
>That's how the cocoon: protocol was designed :) (So, again
>has nothing to do with the portal).
>

I think I already heard similar requests in the context of aggregator 
and [c|x]include transformer, so that it would be possible to execute 
included/aggregated pipelines without ignoring sitemap error handling. 
May be internal sitemap processing can be made more flexible and allow 
execution of handle-errors. WDYT?

Vadim



RE: [Portal] Why don't cocoon errors appear in a coplet ?

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
 
Olivier Billard wrote:
>
> For some of our pipelines, we don't use the cocoon protocol, 
> but just a serverpages generator. Renaming a variable in the 
> XSP to cause a "Language Exception" page, I still have the 
> content of the coplet empty (but as before the decoration 
> remains : <title>My title</title>). And I still have the 
> "correct" error display when calling directly the coplet pipeline.
> 
> I added
>    <attribute>
>      <name>error-uri</name>
>      <value
>        xsi:type="java:java.lang.String"
>        
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon:/
> erreur-coplet</value>
>    </attribute>
> 
> in the profiles/copletdata/portal.xml in my coplet and added 
> a match in the sitemap, in the very beginning to avoid 
> */**-like matchings :
> 
>    <map:match pattern="erreur-coplet">
>      <map:generate type="notifying"/>
>      <map:transform src="stylesheets/system/error2html.xslt">
>        <map:parameter name="contextPath" 
> value="{request:contextPath}"/>
>        <map:parameter name="pageTitle" value="Resource not found"/>
>      </map:transform>
>    </map:match>
> 
> but I have the same result : the content of the coplet is 
> void, and it seems that this pipeline is never called.
>
You can't use the "notifying" generator there as this is a new
pipeline call (internally). So you can e.g. use the file generator
reading a standard error.xml or something like that. 
 
> But it's right that the portal uses the cocoon protocol to 
> aggregate the various coplet contents. But why doesn't it 
> detect map:handle-errors branchings ?
> 
That's how the cocoon: protocol was designed :) (So, again
has nothing to do with the portal). Now, I'm not sure, but
it might be possible to change the code of the portal
coplet adapter, so that it passes the exception into the
error pipeline so that you can use the "notifying" generator.
Might be possible.

Carsten
 


Re: [Portal] Why don't cocoon errors appear in a coplet ?

Posted by Olivier Billard <ob...@rennes.jouve.fr>.
Hi Carsten,

Thanks for your answer.
For some of our pipelines, we don't use the cocoon protocol, but just a serverpages 
generator. Renaming a variable in the XSP to cause a "Language Exception" page, I still 
have the content of the coplet empty (but as before the decoration remains : <title>My 
title</title>). And I still have the "correct" error display when calling directly the 
coplet pipeline.

I added
   <attribute>
     <name>error-uri</name>
     <value
       xsi:type="java:java.lang.String"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">cocoon:/erreur-coplet</value>
   </attribute>

in the profiles/copletdata/portal.xml in my coplet and added
a match in the sitemap, in the very beginning to avoid */**-like matchings :

   <map:match pattern="erreur-coplet">
     <map:generate type="notifying"/>
     <map:transform src="stylesheets/system/error2html.xslt">
       <map:parameter name="contextPath" value="{request:contextPath}"/>
       <map:parameter name="pageTitle" value="Resource not found"/>
     </map:transform>
   </map:match>

but I have the same result : the content of the coplet is void, and it seems that this 
pipeline is never called.

But it's right that the portal uses the cocoon protocol to aggregate the various coplet 
contents. But why doesn't it detect map:handle-errors branchings ?

On 03/03/2004 09:44, Carsten Ziegeler wrote:
> Hi,
> 
> the answer isn't related to the portal but to the Cocoon sitemap
> engine: The portal uses internal pipeline calls (cocoon: protocol).
> Whenever Cocoon uses an internal pipeline call, the error handler
> of that pipeline is never invoked, so if you do a
> 
> <map:generate src="cocoon:/my-pipeline"/>
> 
> and there is an error in your "my-pipeline", the error handler
> of "my-pipeline" is never invoked. In the case above the 
> error handler of the pipeline containing the map:generate is
> invoked.
> 
> In the case of the portal, the error is "ignored". You can specify
> for each coplet an alternative pipeline that is invoked if the 
> real content pipeline throws an error. Have a look at the
> configuration of the coplet showing my weblog. That coplet shows
> the "real" content from the net if you have a network connection,
> if not a static (old) xml file is read.
> 
> HTH
> Carsten
> 
> 
>>-----Original Message-----
>>From: news [mailto:news@sea.gmane.org] On Behalf Of Olivier Billard
>>Sent: Tuesday, March 02, 2004 6:25 PM
>>To: dev@cocoon.apache.org
>>Subject: [Portal] Why don't cocoon errors appear in a coplet ?
>>
>>Hi cocooners !
>>
>>I posted in the users' but maybe some sitemap gurus can show 
>>me the light ;).
>>
>>I use the portal for a project and i'm not able to display 
>>errors in a (main) coplet.
>>I always have a blank content, as if when rendering the 
>>content of the coplet, the error content is not put in the 
>>whole portal page.
>>
>>I tried xml-serializing, html-serializing errors :
>>
>>     <map:handle-errors>
>>       <map:select type="exception">
>>
>>         <map:when test="not-found">
>>           <map:generate type="notifying"/>
>>           <map:transform src="stylesheets/system/error2html.xslt">
>>             <map:parameter name="contextPath" 
>>value="{request:contextPath}"/>
>>             <map:parameter name="pageTitle" value="Resource 
>>not found"/>
>>           </map:transform>
>>           <map:serialize status-code="404"/>
>>         </map:when>
>>
>>         <map:when test="invalid-continuation">
>>           <map:generate src="not-found.xml"/>
>>           <map:transform src="welcome.xslt">
>>             <map:parameter name="contextPath" 
>>value="{request:contextPath}"/>
>>           </map:transform>
>>           <map:serialize status-code="404"/>
>>         </map:when>
>>
>>         <map:otherwise>
>>           <map:generate type="notifying"/>
>>           <map:transform src="stylesheets/system/error2html.xslt">
>>             <map:parameter name="contextPath" 
>>value="{request:contextPath}"/>
>>           </map:transform>
>>           <!--map:serialize status-code="500"/-->
>>--->      <map:serialize type="html"/>
>>         </map:otherwise>
>>       </map:select>
>>
>>     </map:handle-errors>
>>
>>(map:otherwise is choosen, i tried renaming the transformer 
>>src attribute)
>>
>>But no way : I have no content in the coplet...
>>I can right display the error when calling the coplet pipe, 
>>but it' empty in the portal page...
>>
>>It seems to work like standard/error output : when an error 
>>occurs, the standard sitemap output is empty, and the sitemap 
>>error output contains the error catched in the map:handle-errors.
>>
>>Thanks in advance for your answers !
>>
>>--
>>Olivier BILLARD


RE: [Portal] Why don't cocoon errors appear in a coplet ?

Posted by Carsten Ziegeler <cz...@s-und-n.de>.
Hi,

the answer isn't related to the portal but to the Cocoon sitemap
engine: The portal uses internal pipeline calls (cocoon: protocol).
Whenever Cocoon uses an internal pipeline call, the error handler
of that pipeline is never invoked, so if you do a

<map:generate src="cocoon:/my-pipeline"/>

and there is an error in your "my-pipeline", the error handler
of "my-pipeline" is never invoked. In the case above the 
error handler of the pipeline containing the map:generate is
invoked.

In the case of the portal, the error is "ignored". You can specify
for each coplet an alternative pipeline that is invoked if the 
real content pipeline throws an error. Have a look at the
configuration of the coplet showing my weblog. That coplet shows
the "real" content from the net if you have a network connection,
if not a static (old) xml file is read.

HTH
Carsten

> -----Original Message-----
> From: news [mailto:news@sea.gmane.org] On Behalf Of Olivier Billard
> Sent: Tuesday, March 02, 2004 6:25 PM
> To: dev@cocoon.apache.org
> Subject: [Portal] Why don't cocoon errors appear in a coplet ?
> 
> Hi cocooners !
> 
> I posted in the users' but maybe some sitemap gurus can show 
> me the light ;).
> 
> I use the portal for a project and i'm not able to display 
> errors in a (main) coplet.
> I always have a blank content, as if when rendering the 
> content of the coplet, the error content is not put in the 
> whole portal page.
> 
> I tried xml-serializing, html-serializing errors :
> 
>      <map:handle-errors>
>        <map:select type="exception">
> 
>          <map:when test="not-found">
>            <map:generate type="notifying"/>
>            <map:transform src="stylesheets/system/error2html.xslt">
>              <map:parameter name="contextPath" 
> value="{request:contextPath}"/>
>              <map:parameter name="pageTitle" value="Resource 
> not found"/>
>            </map:transform>
>            <map:serialize status-code="404"/>
>          </map:when>
> 
>          <map:when test="invalid-continuation">
>            <map:generate src="not-found.xml"/>
>            <map:transform src="welcome.xslt">
>              <map:parameter name="contextPath" 
> value="{request:contextPath}"/>
>            </map:transform>
>            <map:serialize status-code="404"/>
>          </map:when>
> 
>          <map:otherwise>
>            <map:generate type="notifying"/>
>            <map:transform src="stylesheets/system/error2html.xslt">
>              <map:parameter name="contextPath" 
> value="{request:contextPath}"/>
>            </map:transform>
>            <!--map:serialize status-code="500"/-->
> --->      <map:serialize type="html"/>
>          </map:otherwise>
>        </map:select>
> 
>      </map:handle-errors>
> 
> (map:otherwise is choosen, i tried renaming the transformer 
> src attribute)
> 
> But no way : I have no content in the coplet...
> I can right display the error when calling the coplet pipe, 
> but it' empty in the portal page...
> 
> It seems to work like standard/error output : when an error 
> occurs, the standard sitemap output is empty, and the sitemap 
> error output contains the error catched in the map:handle-errors.
> 
> Thanks in advance for your answers !
> 
> --
> Olivier BILLARD
> 
>