velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Petrelli <antonio.petre...@gmail.com>
Subject Re: [tools-2.0] How to access Writer in tool
Date Thu, 26 Feb 2009 23:00:12 GMT
2009/2/26 Nathan Bubna <nbubna@gmail.com>:
> On Thu, Feb 26, 2009 at 1:41 PM, Antonio Petrelli
> <antonio.petrelli@gmail.com> wrote:
>> Hi all
>> Is there a way to access the writer that is used to write in the
>> response, from a request-scoped tool?
>
> In Velocity 1.6, we introduced the
> org.apache.velocity.runtime.Renderable interface, which has a "boolean
> execute(context, writer)" method.  If, when rendering a reference,
> Velocity comes across a Renderable, it calls that method instead of
> calling toString() and writing that value.  but even if you do
> implement Renderable, please consider having your toString() be
> functional (e.g. passing a StringWriter and null context to
> execute(...)).

Thanks a lot, I will try the Renderable interface.

Antonio

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


Mime
View raw message