Hi Wilson,
This can be done quite simple.

Add an exception generator at the top of your sitemap:
<map:generator name="exception"
src="org.apache.cocoon.generation.ExceptionGenerator"/>

Then at the bottom of your pipelines you can add this which handles the
exceptions. If you add it just above </map:pipelines> it will be the
default error handler for the whole sitemap.

<map:handle-errors when="always">
      <map:generate type="exception"/>
      <map:transform src="transformers/templates/errorpage.xsl"/>
        <map:serialize type="xhtml" status-code="404"/>
</map:handle-errors>

In the xsl you can import your existing layout and styles and style.
This is a simple example, but you can also define correct status codes,
for example:

<map:select type="exception">
          <map:when test="not-found">
            <map:serialize type="xhtml" status-code="404"/>
          </map:when>
          <map:otherwise>
            <map:serialize type="xhtml" status-code="500"/>
          </map:otherwise>
</map:select>

For more information you can visit

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

Regards,
Steven

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Wilson de
Paula Pedro Junior
Sent: donderdag 7 augustus 2008 12:51
To: Hippo CMS development public mailinglist
Subject: [HippoCMS-dev] Customized error page

Hi,

How can I customize an http 500 error page?

Like this one:

HTTP ERROR: 500

nl.hippo.client.api.DocumentNotFoundException: Document not found:
/default/files/default.www/content/nieuws/2008/07/08/JLL-adviseur-Philip
s-voor-High-Tech-Campusd.xml

RequestURI=/live/content/nieuws/2008/07/08/JLL-adviseur-Philips-voor-Hig
h-Tech-Campusd.html
Caused by:

javax.el.ELException: nl.hippo.client.api.DocumentNotFoundException:
Document not found:
/default/files/default.www/content/nieuws/2008/07/08/JLL-adviseur-Philip
s-voor-High-Tech-Campusd.xml
        at javax.el.BeanELResolver.getValue(BeanELResolver.java:266)
        at
javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)...



We want to catch it's message and display it in a page with de website
style.

Thanks,

Wilson
********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Searchable archives can be found at:
MarkMail: http://hippocms-dev.markmail.org
Nabble: http://www.nabble.com/Hippo-CMS-f26633.html

********************************************
Hippocms-dev: Hippo CMS development public mailinglist

Searchable archives can be found at:
MarkMail: http://hippocms-dev.markmail.org
Nabble: http://www.nabble.com/Hippo-CMS-f26633.html

Reply via email to