cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mathias Reem" <M.R...@gmx.net>
Subject Cocoon 2.2 error handlers
Date Tue, 28 Apr 2009 07:53:23 GMT
Hi

I've got a problem with the error handling in cocoon 2.2. If a file can not be found I would
like to present a custom errorpage to the user, but also give him the 404 error code.

I do get the custom error page, but error code is not 404 but 200. :-(

My sitemap.xmpa looks like:
...
<map:selectors default="resource-exists">
 <map:selector name="exception" src="org.apache.cocoon.selection.ExceptionSelector">
  <exception name="not-found" class="org.apache.cocoon.ResourceNotFoundException"/>
  <exception class="java.lang.Throwable" unroll="true"/>
 </map:selector>
</map:selectors>
...
<map:serializers default="xhtml">
 <map:serializer name="xhtml" src="org.apache.cocoon.serialization.XMLSerializer">
  <doctype-public>-//W3C//DTD XHTML 1.0 Strict//EN</doctype-public>
  <doctype-system>http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</doctype-system>
  <encoding>UTF-8</encoding>
 </map:serializer>
</map:serializers>
...
<map:pipeline>
  <map:match pattern="**/*.html">
   <map:generate  type="file"  src="{global:root}/{1}{2}.xml"/>
   <map:call resource="post-process-and-serialize">
    <map:parameter name="resource" value="{global:root}/{1}/{2}.xml"/>
   </map:call>
 </map:match>
 <map:handle-errors>
  <map:select type="exception">
   <map:when test="not-found">
    <map:generate  type="file"  src="resource/websys/errorpage/404.html"/>
    <map:serialize type="xhtml" status-code="404"/>
   </map:when>
   <map:otherwise>
    <map:generate  type="file"  src="resource/websys/errorpage/500.html"/>
    <map:serialize type="xhtml" status-code="500"/>
   </map:otherwise>
  </map:select>
 </map:handle-errors>
</map:pipeline>
...

thx
	Mathias
-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95
Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

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


Mime
View raw message