velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "bluejoe" <bluejoe2...@gmail.com>
Subject Re: Is it possible to load toolboxes from multiple toolbox.xml files?
Date Fri, 20 Feb 2009 09:15:54 GMT
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" <nbubna@gmail.com>
To: "Velocity Users List" <user@velocity.apache.org>
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 <bluejoe@sdb.cnic.cn> 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: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org
Mime
View raw message