You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Manali Joshi <jo...@gmail.com> on 2007/10/18 21:00:06 UTC

What substitutes ToolboxManager.getToolboxContext

Hi,

I am upgrading to Velocity tools 1.3 release to be able to use the
ViewResourceTool. But 1.3 removed the deprecated method
ToolboxManager.getToolboxContext. So, what can I use in code to replace this
in order to get a chained velocity context ?

thanks,
mj

Re: What substitutes ToolboxManager.getToolboxContext

Posted by Nathan Bubna <nb...@gmail.com>.
The replacement for getToolboxContext(Object) is
ToolboxManager.getToolbox(Object) which returns a Map of initialized
tools.  If you simply want any old VelocityContext, then you just
create it yourself like this:

VelocityContext ctx = new
VelocityContext(myToolboxManager.getToolbox(myInitData));

If you specifically want a
org.apache.velocity.tools.view.context.ChainedContext, then you will
still need to create it yourself and then set the toolbox, like this:

ChainedContext ctx = new ChainedContext(myVelocityEngine, httprequest,
httpresponse, servletcontext);
ctx.setToolbox(myToolboxManager.getToolbox(ctx));

the latter is what the VelocityViewServlet does in its
createContext(...) method.

On 10/18/07, Manali Joshi <jo...@gmail.com> wrote:
> Hi,
>
> I am upgrading to Velocity tools 1.3 release to be able to use the
> ViewResourceTool. But 1.3 removed the deprecated method
> ToolboxManager.getToolboxContext. So, what can I use in code to replace this
> in order to get a chained velocity context ?
>
> thanks,
> mj
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
For additional commands, e-mail: user-help@velocity.apache.org