hello, everyone. 

i wrote some application-scoped or request-scoped tools in version 1.x, in 
which all classes were added a method named 'init(Object)'. however, in version 
2.0, I noticed that 'init()' method is depracated, and methods such as 
'setRequest()', 'setServletContext()' and 'setSession()' should be provided if 
necessary.

so my first question is: how to write a application-scoped or request-scoped 
tool? the web page "Creating 
Tools"[http://velocity.apache.org/tools/devel/creatingtools.html] tells 
something about it, but i can not find any suggestion on defining a scoped 
class. which methods are required? should one non-argument constructor be 
provided? should the constructor be public? i do not know.

second, i want to know how the velocity engine load tools, especially scoped 
tools. maybe firstly the engine calls Class.newInstance() to create a instance, 
then it call setRequest() to initialize context? this is just my guess. i want 
to know the truth.

sorry to bother you! waiting for your reply! many thanks!

best regards,
bluejoe
2010-1-11

Reply via email to