velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claude Brisson <>
Subject Re: Documentation for tools xml configuration?
Date Wed, 03 Nov 2010 12:34:41 GMT
On 03/11/2010 12:00, David Parks wrote:
> I see an example configuration file on the website, but no docs that explain
> the configuration format. Is there something I missed? There are a lot of
> options there and I'm having troubles figuring it all out.
> A few specific questions:
> What is the scope parameter, I see request|session|application? Do new
> objects get created per request/scope if you select request or session?
> <toolbox scope=. />
Those scopes only make sense in the context of a web application. 
Toolboxes gather tools within a same scope.
Request-scoped toolboxes get created for each request, session-scoped 
tools get created only once per session, and application-scoped tools 
are only created once for the lifetime of the application.
> How can I extend a class (for example I want to extend MathTool to correct
> the rounding problems noted previously). I can add my own $mymath custom
> class (there's an example of that), but if I try to change the name to
> "math" it doesn't seem to override the existing $math class.
Do you mean that you had an entry like:
<tool key="math" class="my.custom.math.Class"/>
and that $math were still referring to the original math tool?
It should not hapen.
> There is this example:
>     <tool class=""/>
> Can someone just explain what that's doing period?
The DateTool has a default key: "date" (see

so this line will add an instance of this class in the containing 
toolbox (typically an application-scoped toolbox).
> In this example:
>     <tool key="custom" class="org.mine.CustomTool"
> randomProperty="whatever"/>
> Does the "randomProperty" get called as a setter of org.mine.CustomTool
> (e.g. upon creating the object does it then call
> customTool.setRandomProperty(...) )?
Exactly, but if the tool also has the following method:
   public void configure(Map params)
then it will also be called with all configuration parameters (plus 
other standard properties detailed here: )
> I see an example "restrictTo" property of<tool ...>  but what is possible in
> that field? A comma separated list, are regular expressions of any kind
> supported?
This property is detailed in this page:
It can be an exact path or a path ending with *.
> Perhaps some comments in that example file would be enough to make
> everything clear.
You are most welcome if you want to improve us writing this 
documentation. We all have daily jobs...


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message