El Martes, 17 de Septiembre de 2002 05:39, Barry McMullin escribió:
> Hi -
>
> I'm attempting to configure a simple "toy" site with cocoon
> (2.0.3). I have a pipeline which delivers (almost) all pages by
> aggregating a "content" xml file with a "navigation" xml file
> (and doing a little transformation on the result).  This is
> matched on almost every URI I get:
>
>    <map:match pattern="**">
>     <map:aggregate element="page" ns="http://eaccess.rince.ie/xmlns/local";>
>      <map:part src="template/site-nav.xml"/>
>      <map:part src="content/{1}.xml"/>
>     </map:aggregate>
>     <map:transform src="xslt/page-layout-tables.xslt"/>
>     <map:transform src="xslt/strip-xhtmlns.xslt"/>
>     <map:serialize/>
>    </map:match>

You need the <map:handle-errors> element inside your pipeline, for example:

<map:handle-errors>
        <map:transform src="stylesheets/system/error2document.xsl"/>
        <map:transform src="stylesheets/apache.xsl"/>
        <map:serialize status-code="500"/>
</map:handle-errors>

Antonio Gallardo

>
> My problem: because the pattern match is (deliberately) so broad,
> this matches nonsense URIs - for which I would like to return a
> "proper" 404 status.  But - apparently - if a <map:part> doesn't
> generate any content (in this case because the corresponding file
> does not exist) that does not raise any exception for the
> pipeline as a whole.  So if I use a nonsense URI, instead of a
> 404 I get a page with an empty content part (and a normal
> navigation part).
>
> I have tried moving the reading of the content file into a
> pipeline of its own (and using the "cocoon:" protocol in map:part
> to get to it).  If I contrive to use that pipeline in isolation,
> for a nonsense URL, I get a standard cocoon exception page
> (albeit with a 500 status instead of 404); but when I use the
> aggregating pipeline it still "silently" returns an empty content
> page.
>
> As far as I can see, <map-error-handler> is not relevant to this
> (as it would only allow customisation of the error page - but I'm
> not getting such a page at all?).
>
> I have trawled both the docs and the mailing list, but without
> finding any clear guide on what to do here (but I freely admit
> I'm only slowly coming up to speed).  I can imagine a variety
> of ways of fixing this; but I'm wondering is there a "preferred"
> or "recommended" approach - it seems like a fairly general issue?
>
> Thanks,
>
> - Barry.

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to