velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Bubna" <nbu...@gmail.com>
Subject Re: What substitutes ToolboxManager.getToolboxContext
Date Thu, 18 Oct 2007 20:56:37 GMT
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 <joshi.manali@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


Mime
View raw message