public class WebappUberspector
extends org.apache.velocity.util.introspection.AbstractChainableUberspector
This custom uberspector allows getAttribute() and setAttribute() as standard getters and setters for the "request","session" and "application" keys.
It allows VTL statements like:
#set($session.foo = 'youpi') session parameter 'foo' has value: $session.foo
This uberspector requires Velocity 1.6+ ; to use it, you must specify org.apache.velocity.tools.view.WebappUberspector
as the last uberspector to the runtime.introspector.uberspect property in you velocity.properties file.
For instance:
runtime.introspector.uberspect = org.apache.velocity.util.introspection.UberspectImpl,org.apache.velocity.tools.view.WebappUberspector
| Modifier and Type | Class and Description |
|---|---|
class |
WebappUberspector.GetAttributeExecutor
Executor for getAttribute(name) method.
|
class |
WebappUberspector.SetAttributeExecutor
Executor for setAttribute(name,value) method
|
org.apache.velocity.util.introspection.UberspectImpl.VelGetterImpl, org.apache.velocity.util.introspection.UberspectImpl.VelMethodImpl, org.apache.velocity.util.introspection.UberspectImpl.VelSetterImpl| Constructor and Description |
|---|
WebappUberspector() |
| Modifier and Type | Method and Description |
|---|---|
org.apache.velocity.util.introspection.VelPropertyGet |
getPropertyGet(Object obj,
String identifier,
org.apache.velocity.util.introspection.Info i)
Property getter
|
org.apache.velocity.util.introspection.VelPropertySet |
getPropertySet(Object obj,
String identifier,
Object arg,
org.apache.velocity.util.introspection.Info i)
Property setter
|
void |
init()
init method
|
getIterator, getMethod, wrappublic org.apache.velocity.util.introspection.VelPropertyGet getPropertyGet(Object obj, String identifier, org.apache.velocity.util.introspection.Info i)
getPropertyGet in interface org.apache.velocity.util.introspection.UberspectgetPropertyGet in class org.apache.velocity.util.introspection.AbstractChainableUberspectorobj - target objectidentifier - property keyi - tool infopublic void init()
init in interface org.apache.velocity.util.introspection.Uberspectinit in class org.apache.velocity.util.introspection.AbstractChainableUberspectorpublic org.apache.velocity.util.introspection.VelPropertySet getPropertySet(Object obj, String identifier, Object arg, org.apache.velocity.util.introspection.Info i)
getPropertySet in interface org.apache.velocity.util.introspection.UberspectgetPropertySet in class org.apache.velocity.util.introspection.AbstractChainableUberspectorobj - target objectidentifier - property keyarg - value to seti - tool infoCopyright © 2002–2021 The Apache Software Foundation. All rights reserved.