org.apache.cocoon.selection
Class XPathExceptionSelector
java.lang.Object
org.apache.cocoon.util.AbstractLogEnabled
org.apache.cocoon.selection.AbstractSwitchSelector
org.apache.cocoon.selection.ExceptionSelector
org.apache.cocoon.selection.XPathExceptionSelector
- All Implemented Interfaces:
- Configurable, org.apache.cocoon.selection.Selector, org.apache.cocoon.selection.SwitchSelector, ThreadSafe
- public class XPathExceptionSelector
- extends ExceptionSelector
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.
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>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 <map:when> tests
- Since:
- 2.1
- Version:
- $Id: XPathExceptionSelector.html 1304280 2012-03-23 11:18:01Z ilgrosso $
Fields inherited from interface org.apache.cocoon.selection.SwitchSelector |
ROLE |
Methods inherited from class org.apache.cocoon.selection.AbstractSwitchSelector |
select |
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled |
getLogger, setLogger |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XPathExceptionSelector
public XPathExceptionSelector()
configure
public void configure(Configuration conf)
throws ConfigurationException
- Specified by:
configure
in interface Configurable
- Overrides:
configure
in class ExceptionSelector
- Throws:
ConfigurationException
getSelectorContext
public Object getSelectorContext(Map objectModel,
Parameters parameters)
- Compute the exception type, given the configuration and the exception stored in the object model.
- Specified by:
getSelectorContext
in interface org.apache.cocoon.selection.SwitchSelector
- Overrides:
getSelectorContext
in class ExceptionSelector
- See Also:
ObjectModelHelper.getThrowable(java.util.Map)
Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.