Class WebappUberspector
java.lang.Object
org.apache.velocity.util.introspection.UberspectImpl
org.apache.velocity.util.introspection.AbstractChainableUberspector
org.apache.velocity.tools.view.WebappUberspector
- All Implemented Interfaces:
org.apache.velocity.util.introspection.ChainableUberspector, org.apache.velocity.util.introspection.Uberspect, org.apache.velocity.util.RuntimeServicesAware
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
- Version:
- $Id: WebappUberspector.java $
- Author:
- Claude Brisson
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassExecutor for getAttribute(name) method.classExecutor for setAttribute(name,value) methodNested classes/interfaces inherited from class org.apache.velocity.util.introspection.UberspectImpl
org.apache.velocity.util.introspection.UberspectImpl.VelGetterImpl, org.apache.velocity.util.introspection.UberspectImpl.VelMethodImpl, org.apache.velocity.util.introspection.UberspectImpl.VelSetterImpl -
Field Summary
Fields inherited from class org.apache.velocity.util.introspection.AbstractChainableUberspector
innerFields inherited from class org.apache.velocity.util.introspection.UberspectImpl
conversionHandler, introspector, log, rsvc -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.velocity.util.introspection.VelPropertyGetgetPropertyGet(Object obj, String identifier, org.apache.velocity.util.introspection.Info i) Property getterorg.apache.velocity.util.introspection.VelPropertySetgetPropertySet(Object obj, String identifier, Object arg, org.apache.velocity.util.introspection.Info i) Property settervoidinit()init methodMethods inherited from class org.apache.velocity.util.introspection.AbstractChainableUberspector
getIterator, getMethod, wrapMethods inherited from class org.apache.velocity.util.introspection.UberspectImpl
getConversionHandler, setLog, setRuntimeServices
-
Constructor Details
-
WebappUberspector
public WebappUberspector()
-
-
Method Details
-
getPropertyGet
public org.apache.velocity.util.introspection.VelPropertyGet getPropertyGet(Object obj, String identifier, org.apache.velocity.util.introspection.Info i) Property getter- Specified by:
getPropertyGetin interfaceorg.apache.velocity.util.introspection.Uberspect- Overrides:
getPropertyGetin classorg.apache.velocity.util.introspection.AbstractChainableUberspector- Parameters:
obj- target objectidentifier- property keyi- tool info- Returns:
- A Velocity Getter Method.
-
init
public void init()init method- Specified by:
initin interfaceorg.apache.velocity.util.introspection.Uberspect- Overrides:
initin classorg.apache.velocity.util.introspection.AbstractChainableUberspector
-
getPropertySet
public org.apache.velocity.util.introspection.VelPropertySet getPropertySet(Object obj, String identifier, Object arg, org.apache.velocity.util.introspection.Info i) Property setter- Specified by:
getPropertySetin interfaceorg.apache.velocity.util.introspection.Uberspect- Overrides:
getPropertySetin classorg.apache.velocity.util.introspection.AbstractChainableUberspector- Parameters:
obj- target objectidentifier- property keyarg- value to seti- tool info- Returns:
- A Velocity Setter method.
-