org.apache.velocity.tools.view
Class WebappUberspector

java.lang.Object
  extended by AbstractChainableUberspector
      extended by org.apache.velocity.tools.view.WebappUberspector

public class WebappUberspector
extends 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
 class WebappUberspector.GetAttributeExecutor
          Executor for getAttribute(name) method.
 class WebappUberspector.SetAttributeExecutor
          Executor for setAttribute(name,value) method
 
Constructor Summary
WebappUberspector()
           
 
Method Summary
 VelPropertyGet getPropertyGet(java.lang.Object obj, java.lang.String identifier, Info i)
          Property getter
 VelPropertySet getPropertySet(java.lang.Object obj, java.lang.String identifier, java.lang.Object arg, Info i)
          Property setter
 void init()
          init method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebappUberspector

public WebappUberspector()
Method Detail

getPropertyGet

public VelPropertyGet getPropertyGet(java.lang.Object obj,
                                     java.lang.String identifier,
                                     Info i)
                              throws java.lang.Exception
Property getter

Parameters:
obj -
identifier -
i -
Returns:
A Velocity Getter Method.
Throws:
java.lang.Exception

init

public void init()
init method


getPropertySet

public VelPropertySet getPropertySet(java.lang.Object obj,
                                     java.lang.String identifier,
                                     java.lang.Object arg,
                                     Info i)
                              throws java.lang.Exception
Property setter

Parameters:
obj -
identifier -
arg -
i -
Returns:
A Velocity Setter method.
Throws:
java.lang.Exception


Copyright (c) 2003-2007 Apache Software Foundation