The method given by Nathan works for VelocityTools 2.0. It's unreleased yet, but very close to, so you may give it a try. You can find it here:
http://people.apache.org/~nbubna/velocity/tools/2.0-SNAPSHOT/ With VelocityTools 1.4 it is probably also feasible by using a custom VelocityViewServlet and overriding the initToolbox() method. Not tested, though. Claude On ven, 2009-02-20 at 17:15 +0800, bluejoe wrote: > Thank you! However, I failed to find VelocityView class in the lastest > release version of velocity-tools-view-1.4.jar. Then I turned to SVN > repository and found it there. I want to know when the version > including VelocityView class will be released? :) > > ----- Original Message ----- > From: "Nathan Bubna" <[email protected]> > To: "Velocity Users List" <[email protected]> > Sent: Thursday, February 19, 2009 11:14 PM > Subject: Re: Is it possible to load toolboxes from multiple toolbox.xml files? > > > Yeah, you can do this. And there are several different ways it can be > done. One is to use a custom VelocityView class. > > public MyVelocityView extends VelocityView { > > @Override > protected void init(JeeConfig config) { > super.init(config); > String otherConfig = config.getInitParameter("user.toolbox.path"); > if (otherConfig != null) { > FactoryConfiguration factoryConfig = getConfiguration(otherConfig, > true); > configure(factoryConfig); > } > } > > } > > You can call the configure(FactoryConfig) method as many times as you > like, of course. Once you have your custom VelocityView class, you > can tell the VelocityViewServlet to use it by adding this to your > init-params: > > <init-param> > <param-name>org.apache.velocity.tools.view.class</param-name> > <param-value>com.foo.MyVelocityView</param-value> > </init-param> > > Like i said, there are other ways, but this was the first that came to > mind. In general, the methods that are your friends are > velocityView.configure(FactoryConfiguration) and > ServletUtils.getConfiguration(String,ServletContext). > > On Wed, Feb 18, 2009 at 10:14 PM, bluejoe <[email protected]> wrote: > > Hi, > > > > With VelocityView, I want to load toolboxes from multiple files, for > > example, from both '/WEB-INF/toolbox.xml' and '/WEB-INF/toolbox.user.xml', > > the later file maybe be provided by other developers instead of myself. But > > I have no idea how to do because it seems that VelocityViewServlet only use > > '/WEB-INF/toolbox.xml' as input. > > > > Can anyone give me any advice? > > > > Thanks for any help. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
