org.apache.cocoon.selection
Class XPathExceptionSelector
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.apache.cocoon.selection.AbstractSwitchSelector
org.apache.cocoon.selection.ExceptionSelector
org.apache.cocoon.selection.XPathExceptionSelector
- All Implemented Interfaces:
- Component, Configurable, LogEnabled, ThreadSafe, Selector, SwitchSelector
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:
- CVS $Id: XPathExceptionSelector.html 1304258 2012-03-23 10:09:27Z ilgrosso $
- Author:
- Jürgen Seitz, Björn Lütkemeier
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 SwitchSelector
- Overrides:
getSelectorContext
in class ExceptionSelector
- Parameters:
objectModel
- The Map
containing object of the
calling environment which may be used
to select values to test the expression.parameters
- The sitemap parameters, as specified by
<parameter/> tags.
- Returns:
- Selector context
- See Also:
ObjectModelHelper.getThrowable(java.util.Map)
Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.