You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by David Rogers <da...@excira.com> on 2003/11/16 22:14:50 UTC

Using


Hi,

I can't get the  <map:handle-errors> portion of the pipeline to execute.
Do I have to define a selector or do something else besides this?

I want the pipeline to return an xhtml file if it cant find the requested
xml file.

This is the pipeline: 
Any idea what else i should be doing? I am using 2.1.1

Thanks,
Dave

   <map:pipeline>
    <!--*****************************************-->
    <map:match pattern="*/*/*.xml">
    <!--*****************************************-->
      <map:aggregate element="included" >
         <!--map:part src="cocoon:/request"/-->
	   <map:part src="{1}/siteconfig/session.xml"/>
         <map:part src="cocoon:/session/appState"/>
	   <map:part src="{1}/{2}/{3}.xml"/>
       </map:aggregate>
      
       <map:transform src="_common/_xsl/displayarea.xsl"/>
	 <map:transform src="_common/_xsl/widget.xsl"/>
       <map:transform src="_common/_xsl/dinclude.xsl"/>
       <map:transform src="_common/_xsl/stripper.xsl"/>
       <map:transform type="cinclude"/>

       <map:serialize type="xml" />
    </map:match>
    
    <map:handle-errors>
      <map:generate src="{1}/xhtml/filenotfound.xhtml"/>
	<map:serialize type="xml"/>
    </map:handle-errors>
   
   </map:pipeline>	


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


RE: Using

Posted by David Rogers <da...@excira.com>.
Still no joy... let me summarize..

I cant get the <map:handle-errors> to execute in my sub site map.


Yes I am using a sub site map. I commented out the handle-error blocks
in the main site map and now i get a different wrong error page.
The new wrong error page is the cocoon "Internal Server Error" page rather
that the usual
"An error occurred " page.


 the main pipeline has a selector definition like this
...
<map:selector logger="sitemap.selector.exception" name="exception"
src="org.apache.cocoon.selection.ExceptionSelector">
     <exception class="org.apache.cocoon.ResourceNotFoundException"
name="not-found"/>
     <exception
class="org.apache.cocoon.components.flow.InvalidContinuationException"
name="invalid-continuation"/>
     <!-- The statement below tells the selector to unroll as much
exceptions as possible -->
     <exception class="java.lang.Throwable" unroll="true"/>
   </map:selector>
...

So with no handel errors in the main sitemap I expect the handle errors in
the sub site map
to work (and reference the selector definition in the main sitemap)

The sub pipeline is listed below. It has two pipelines.
The first one <map:match pattern="*/site.xml"> calls
the 2nd one with a <cinclude>.

When the 2nd pipeline fails i would like it to return
a different xml file than the one requested. Say for now
just return the "welcome.xml" file which I know exists.

This should be done by the <map:handle-errors> in the 2nd
pipeline?? Sounds nice in thory!!! But in practice i cant make it work!!

Thanks again..

Dave


<map:pipelines>
	(first pipeline)
  <map:pipeline>
    <!--*****************************************-->
    <map:match pattern="*/site.xml">
    <!--*****************************************-->
      <map:aggregate element="root">
        <!--map:part src="cocoon:/request"/-->
        <map:part src="cocoon:/session/appState"/>
         <map:part src="{1}/siteconfig/session.xml"/>
        <map:part src="{1}/siteconfig/root.xml"/>
      </map:aggregate>

	    <map:transform src="_common/_xsl/displayarea.xsl"/>
	    <map:transform src="_common/_xsl/widget.xsl"/>
      <map:transform src="_common/_xsl/dinclude.xsl"/>
      <map:transform type="cinclude"/>

      <map:transform src="_common/_xsl/einclude.xsl"/>
      <map:transform src="_common/_xsl/main.xsl"/>
      <map:transform src="_common/_xsl/indentxhtml.xsl"/>
      <map:serialize type="xhtml"/>
    </map:match>

	(2nd pipeline....called by cinclude in above pipeline)
   <map:pipeline>
    <!--*****************************************-->
    <map:match pattern="*/*/*.xml">
    <!--*****************************************-->
      <map:aggregate element="included" >
         <!--map:part src="cocoon:/request"/-->
		   <map:part src="{1}/siteconfig/session.xml"/>
         <map:part src="cocoon:/session/appState"/>
         <map:part src="{1}/{2}/{3}.xml"/>     **(when this is not
found...)***???
       </map:aggregate>

       <map:transform src="_common/_xsl/displayarea.xsl"/>
	    <map:transform src="_common/_xsl/widget.xsl"/>
       <map:transform src="_common/_xsl/dinclude.xsl"/>
       <map:transform src="_common/_xsl/stripper.xsl"/>
       <map:transform type="cinclude"/>

       <map:serialize type="xml" />
    </map:match>

    <map:handle-errors> ***(this should execute)**???
      <map:select type="exception">
         <map:when test="not-found">
            <map:generate src="doingatkins.com/repository/welcome.xml"/>
             <!--map:generate src="{1}/xhtml/filenotfound.xhtml"/-->
             <map:serialize type="xml"/>
          </map:when>
       </map:select>
    </map:handle-errors>
    </map:pipeline>

  </map:pipelines>
</map:sitemap>

just to be complete the error follows. The page in the exception string is
the original missing (cautionv.xml) page and not one from the handel-errors
map generate so i think the handel-errors is not executing.

Any ideas???

Description: org.apache.cocoon.ProcessingException: Failed to execute
pipeline.: java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.RuntimeException: org.apache.cocoon.ProcessingException: Failed to
execute pipeline.: java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.RuntimeException: java.lang.RuntimeException:
org.apache.cocoon.ResourceNotFoundException: Resource not found.:
org.apache.excalibur.source.SourceNotFoundException:
file:/C:/eclipse/workspace/MetaWorks/sites/doingatkins.com/repository/cautio
nv.xml doesn't exist.






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


Re: Using

Posted by Stephan Coboos <cr...@gmx.net>.
----- Original Message ----- 
From: "David Rogers" <da...@excira.com>
To: <us...@cocoon.apache.org>
Sent: Monday, November 17, 2003 8:25 AM
Subject: RE: Using <map:handle-errors>


>
> Hi..
> >From where do you get the sitemap variables {1} and {2}?
>
> The containing stite map has the match pattern   <map:match
> pattern="*/*/*.xml">
> the site map variables are accessable in the handle-errors block are they
> not?
> Also the error i get has the file name of the original missing file not
the
> name of the file in the handle-errors block. This indicates to me that the
> handle-errors block is not executing at all rather than failing?
>
> I just tried puting a full path "site/repository/welcome.xml" instead of
the
> {1}/{2}/welcome.xml and that didnt work either... so?????
>

Do you use a sub-sitemap? It seems to me that the definition of
<map:error-handlers/> in the root sitmap overwrites the one in the
sub-sitemap. I had removed the one in the root sitemap and now it works
correct... Makes this sense??

Regards
Stephan


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


RE: Using

Posted by David Rogers <da...@excira.com>.
Hi..
>>From where do you get the sitemap variables {1} and {2}?

The containing stite map has the match pattern   <map:match
pattern="*/*/*.xml">
the site map variables are accessable in the handle-errors block are they
not?
Also the error i get has the file name of the original missing file not the
name of the file in the handle-errors block. This indicates to me that the
handle-errors block is not executing at all rather than failing?

I just tried puting a full path "site/repository/welcome.xml" instead of the
{1}/{2}/welcome.xml and that didnt work either... so?????


Thanks Again...

-Dave




-----Original Message-----
From: Stephan Coboos [mailto:cromosom@gmx.net]
Sent: Monday, November 17, 2003 2:21 AM
To: users@cocoon.apache.org
Subject: Re: Using <map:handle-errors>



----- Original Message -----
From: "David Rogers" <da...@excira.com>
To: <us...@cocoon.apache.org>
Sent: Monday, November 17, 2003 12:04 AM
Subject: RE: Using <map:handle-errors>


>
> Hmm..thanks. still having trouble..
>
> I am using a sub site map.
> I see the main site map has the selector declaration already....
>
>  <map:selector logger="sitemap.selector.exception" name="exception"
> src="org.apache.cocoon.selection.ExceptionSelector">
>      <exception class="org.apache.cocoon.ResourceNotFoundException"
> name="not-found"/>
>      <exception
> class="org.apache.cocoon.components.flow.InvalidContinuationException"
> name="invalid-continuation"/>
>      <!-- The statement below tells the selector to unroll as much
> exceptions as possible -->
>      <exception class="java.lang.Throwable" unroll="true"/>
>    </map:selector>
>
>
> But when i try to refrence it using:
>
>  <map:handle-errors>
>       <map:select type="exception">
>          <map:when test="not-found">
>             <map:generate src="{1}/{2}/welcome.xml"/>
>              <!--map:generate src="{1}/xhtml/filenotfound.xhtml"/-->
>              <map:serialize type="xml"/>
>           </map:when>
>        </map:select>
>  </map:handle-errors>
>
> I still get the main erorr page with this...
>
> java.lang.RuntimeException: java.lang.RuntimeException:
> java.lang.RuntimeException: org.apache.cocoon.ProcessingException: Failed
to
> execute pipeline.: java.lang.RuntimeException: java.lang.RuntimeException:
> java.lang.RuntimeException: java.lang.RuntimeException:
> org.apache.cocoon.ResourceNotFoundException: Resource not found.:
> org.apache.excalibur.source.SourceNotFoundException:
>
file:/C:/eclipse/workspace/MetaWorks/sites/doingatkins.com/repository/cautio
> nn.xml doesn't exist.
>
>
> almost there...
> Thanks,
> Dave
>
>
>

>From where do you get the sitemap variables {1} and {2}?


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





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


Re: Using

Posted by Stephan Coboos <cr...@gmx.net>.
----- Original Message ----- 
From: "David Rogers" <da...@excira.com>
To: <us...@cocoon.apache.org>
Sent: Monday, November 17, 2003 12:04 AM
Subject: RE: Using <map:handle-errors>


>
> Hmm..thanks. still having trouble..
>
> I am using a sub site map.
> I see the main site map has the selector declaration already....
>
>  <map:selector logger="sitemap.selector.exception" name="exception"
> src="org.apache.cocoon.selection.ExceptionSelector">
>      <exception class="org.apache.cocoon.ResourceNotFoundException"
> name="not-found"/>
>      <exception
> class="org.apache.cocoon.components.flow.InvalidContinuationException"
> name="invalid-continuation"/>
>      <!-- The statement below tells the selector to unroll as much
> exceptions as possible -->
>      <exception class="java.lang.Throwable" unroll="true"/>
>    </map:selector>
>
>
> But when i try to refrence it using:
>
>  <map:handle-errors>
>       <map:select type="exception">
>          <map:when test="not-found">
>             <map:generate src="{1}/{2}/welcome.xml"/>
>              <!--map:generate src="{1}/xhtml/filenotfound.xhtml"/-->
>              <map:serialize type="xml"/>
>           </map:when>
>        </map:select>
>  </map:handle-errors>
>
> I still get the main erorr page with this...
>
> java.lang.RuntimeException: java.lang.RuntimeException:
> java.lang.RuntimeException: org.apache.cocoon.ProcessingException: Failed
to
> execute pipeline.: java.lang.RuntimeException: java.lang.RuntimeException:
> java.lang.RuntimeException: java.lang.RuntimeException:
> org.apache.cocoon.ResourceNotFoundException: Resource not found.:
> org.apache.excalibur.source.SourceNotFoundException:
>
file:/C:/eclipse/workspace/MetaWorks/sites/doingatkins.com/repository/cautio
> nn.xml doesn't exist.
>
>
> almost there...
> Thanks,
> Dave
>
>
>

>From where do you get the sitemap variables {1} and {2}?


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


RE: Using

Posted by David Rogers <da...@excira.com>.
Hmm..thanks. still having trouble..

I am using a sub site map.
I see the main site map has the selector declaration already....

 <map:selector logger="sitemap.selector.exception" name="exception"
src="org.apache.cocoon.selection.ExceptionSelector">
     <exception class="org.apache.cocoon.ResourceNotFoundException"
name="not-found"/>
     <exception
class="org.apache.cocoon.components.flow.InvalidContinuationException"
name="invalid-continuation"/>
     <!-- The statement below tells the selector to unroll as much
exceptions as possible -->
     <exception class="java.lang.Throwable" unroll="true"/>
   </map:selector>


But when i try to refrence it using:

 <map:handle-errors>
      <map:select type="exception">
         <map:when test="not-found">
            <map:generate src="{1}/{2}/welcome.xml"/>
             <!--map:generate src="{1}/xhtml/filenotfound.xhtml"/-->
             <map:serialize type="xml"/>
          </map:when>
       </map:select>
 </map:handle-errors>

I still get the main erorr page with this...

java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.RuntimeException: org.apache.cocoon.ProcessingException: Failed to
execute pipeline.: java.lang.RuntimeException: java.lang.RuntimeException:
java.lang.RuntimeException: java.lang.RuntimeException:
org.apache.cocoon.ResourceNotFoundException: Resource not found.:
org.apache.excalibur.source.SourceNotFoundException:
file:/C:/eclipse/workspace/MetaWorks/sites/doingatkins.com/repository/cautio
nn.xml doesn't exist.


almost there...
Thanks,
Dave






















-----Original Message-----
From: Stephan Coboos [mailto:cromosom@gmx.net]
Sent: Sunday, November 16, 2003 5:00 PM
To: users@cocoon.apache.org
Subject: Re: Using <map:handle-errors>



----- Original Message -----
From: "David Rogers" <da...@excira.com>
To: <us...@cocoon.apache.org>
Sent: Sunday, November 16, 2003 10:14 PM
Subject: Using <map:handle-errors>


>
>
> Hi,
>
> I can't get the  <map:handle-errors> portion of the pipeline to execute.
> Do I have to define a selector or do something else besides this?
>
> I want the pipeline to return an xhtml file if it cant find the requested
> xml file.
>
> This is the pipeline:
> Any idea what else i should be doing? I am using 2.1.1
>
> Thanks,
> Dave
>
>    <map:pipeline>
>     <!--*****************************************-->
>     <map:match pattern="*/*/*.xml">
>     <!--*****************************************-->
>       <map:aggregate element="included" >
>          <!--map:part src="cocoon:/request"/-->
>    <map:part src="{1}/siteconfig/session.xml"/>
>          <map:part src="cocoon:/session/appState"/>
>    <map:part src="{1}/{2}/{3}.xml"/>
>        </map:aggregate>
>
>        <map:transform src="_common/_xsl/displayarea.xsl"/>
> <map:transform src="_common/_xsl/widget.xsl"/>
>        <map:transform src="_common/_xsl/dinclude.xsl"/>
>        <map:transform src="_common/_xsl/stripper.xsl"/>
>        <map:transform type="cinclude"/>
>
>        <map:serialize type="xml" />
>     </map:match>
>
>     <map:handle-errors>
>       <map:generate src="{1}/xhtml/filenotfound.xhtml"/>
> <map:serialize type="xml"/>
>     </map:handle-errors>
>
>    </map:pipeline>

Hello,

you need an exception selector for example. Look at the code snipplet as
follows...

...
<map:selector name="exception"
   src="org.apache.selection.ExceptionSelector">

   <exception name="notFound"
      class="FileNotFoundException"/>
   ...
</map:selector>
...
<map:pipeline>
   ...
   <map:handle-errors>
      <map:select type="exception">
         <map:when test="notFound">
            <map:generate src="FileNotFound.html"/>
            <map:serialize type="html"
               status-code="404"/>
         </map:when>
      </map:select>
   </map:handle-errors>
</map:pipeline>
...

Regards
Stephan


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





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


Re: Using

Posted by Stephan Coboos <cr...@gmx.net>.
----- Original Message ----- 
From: "David Rogers" <da...@excira.com>
To: <us...@cocoon.apache.org>
Sent: Sunday, November 16, 2003 10:14 PM
Subject: Using <map:handle-errors>


>
>
> Hi,
>
> I can't get the  <map:handle-errors> portion of the pipeline to execute.
> Do I have to define a selector or do something else besides this?
>
> I want the pipeline to return an xhtml file if it cant find the requested
> xml file.
>
> This is the pipeline:
> Any idea what else i should be doing? I am using 2.1.1
>
> Thanks,
> Dave
>
>    <map:pipeline>
>     <!--*****************************************-->
>     <map:match pattern="*/*/*.xml">
>     <!--*****************************************-->
>       <map:aggregate element="included" >
>          <!--map:part src="cocoon:/request"/-->
>    <map:part src="{1}/siteconfig/session.xml"/>
>          <map:part src="cocoon:/session/appState"/>
>    <map:part src="{1}/{2}/{3}.xml"/>
>        </map:aggregate>
>
>        <map:transform src="_common/_xsl/displayarea.xsl"/>
> <map:transform src="_common/_xsl/widget.xsl"/>
>        <map:transform src="_common/_xsl/dinclude.xsl"/>
>        <map:transform src="_common/_xsl/stripper.xsl"/>
>        <map:transform type="cinclude"/>
>
>        <map:serialize type="xml" />
>     </map:match>
>
>     <map:handle-errors>
>       <map:generate src="{1}/xhtml/filenotfound.xhtml"/>
> <map:serialize type="xml"/>
>     </map:handle-errors>
>
>    </map:pipeline>

Hello,

you need an exception selector for example. Look at the code snipplet as
follows...

...
<map:selector name="exception"
   src="org.apache.selection.ExceptionSelector">

   <exception name="notFound"
      class="FileNotFoundException"/>
   ...
</map:selector>
...
<map:pipeline>
   ...
   <map:handle-errors>
      <map:select type="exception">
         <map:when test="notFound">
            <map:generate src="FileNotFound.html"/>
            <map:serialize type="html"
               status-code="404"/>
         </map:when>
      </map:select>
   </map:handle-errors>
</map:pipeline>
...

Regards
Stephan


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