runtime.introspector.uberspect.chainClasses to runtime.introspector.uberspect@Deprecated public class ChainingUberspector extends AbstractChainableUberspector implements org.apache.velocity.util.introspection.Uberspect, org.apache.velocity.util.RuntimeServicesAware, org.apache.velocity.util.introspection.UberspectLoggable
Since the current version of the Velocity engine (1.5) does not allow more than one uberspector, this class is a
workaround. It manually constructs a chain of uberspectors, loading the classes in the order
defined in the "runtime.introspector.uberspect.chainClasses" property, and after that simply
forwarding all calls to the top of the chain. Note that the calls will be made from the rightmost class to the
leftmost one. Along the chain, each uberspectors can forward the call to the rest of the chain, build its own result,
and/or process in any way the resulting value. This allows uberspectors to enhance the list of returned methods,
block out methods returned by other uberspectors, or take various actions on the returned method (for example add or
remove parameters before searching the method, log executed method names, or catch exceptions when executing those
methods).
This is not actually part of the chain, but is more of a handle that allows the calls intended for only one uberspector to reach the chain. It duplicates some of the code from the velocity runtime initialization code, hoping that a future version of the engine will support chaining natively.
The chain is defined using the configuration parameter runtime.introspector.uberspect.chainClasses.
This property should contain a list of canonical class names. Any wrong entry in the list will be ignored. If this
property is not defined or contains only wrong classnames, then by default a SecureUberspector is used
as the only entry in the chain. The first (leftmost) uberspector does not have to be chainable (as it will not need
to forward calls). If a uberspector in the middle of the chain is not chainable, then it will break the chain at that
point (all previos uberspectors will be discarded from the chain).
ChainableUberspectororg.apache.velocity.util.introspection.UberspectImpl.VelGetterImpl, org.apache.velocity.util.introspection.UberspectImpl.VelMethodImpl, org.apache.velocity.util.introspection.UberspectImpl.VelSetterImpl| Modifier and Type | Field and Description |
|---|---|
static String |
UBERSPECT_CHAIN_CLASSNAMES
Deprecated.
The key of the parameter that allows defining the list of chained uberspectors.
|
| Constructor and Description |
|---|
ChainingUberspector()
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
void |
init()
Deprecated.
|
protected void |
initializeUberspector(String classname)
Deprecated.
Instantiates an uberspector class and adds it to the chain.
|
protected org.apache.velocity.util.introspection.Uberspect |
instantiateUberspector(String classname)
Deprecated.
Tries to create an uberspector instance using reflection.
|
void |
setRuntimeServices(org.apache.velocity.runtime.RuntimeServices rs)
Deprecated.
|
getIterator, getMethod, getPropertyGet, getPropertySet, wrapsetLog, setRuntimeLoggerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetIterator, getMethod, getPropertyGet, getPropertySetpublic static final String UBERSPECT_CHAIN_CLASSNAMES
public void setRuntimeServices(org.apache.velocity.runtime.RuntimeServices rs)
setRuntimeServices in interface org.apache.velocity.util.RuntimeServicesAwarepublic void init()
This implementation initializes the uberspector chain.
init in interface org.apache.velocity.util.introspection.Uberspectinit in class AbstractChainableUberspectorUberspect.init()protected void initializeUberspector(String classname)
Uberspect.init() method is not called.classname - The name of the uberspector class to add to the chain.protected org.apache.velocity.util.introspection.Uberspect instantiateUberspector(String classname)
classname - The name of the uberspector class to instantiate.Uberspect, null is returned.Copyright © 2004–2016 XWiki. All rights reserved.