Apache » Cocoon »

  Cocoon Core
      2.2
   homepage

Cocoon Core 2.2

XPathExceptionSelector

Summary

Additional to the inherited functionality from its superclass ExceptionSelector, this selector allows to define xpath expressions to evaluate supplemental information given in the thrown exception.

Basic information

Component typeSelector
Cocoon blockcore
Java classorg.apache.cocoon.selection.XPathExceptionSelector
Name in Sitemap
Cacheable

Documentation

The configuration of this selector allows to map not only exceptions but also
xpath expressions to symbolic names that are used in the <map:when> alternatives.

Example configuration :

<map:selector type="error" src="....XPathExceptionSelector">
  <exception name="denied" class="my.comp.auth.AuthenticationFailure">
    <xpath name="PasswordWrong" test="authCode=10"/>
    <xpath name="PasswordExpired" test="errorCode=11"/>
    <xpath name="AccessForbidden" test="errorCode&gt;11"/>
  </exception>
</map:selector>

This example shows several features:

  • the test is the xpath expression that will be evaluated against the exception ,
  • an xpath expression can be given a name, which is used in the &lt;map:when> tests