I got it from the VelocityViewServlet in velocity-tools-1.2-src.zip. I guess
the basic question was - short of profiling the app - is one method faster
and/or better than the other? It would seem to me like the pooled
VelocityWriters are the way to go?

John

On 1/4/07, Nathan Bubna <[EMAIL PROTECTED]> wrote:

What version of the VelocityViewServlet are you taking that code from?
It hasn't looked that way in some time.   I'd recommend taking a look
at a more recent version of the VelocityViewServlet's code to begin.
Beyond that, i can't really tell whether it is better for your
application to do what VVS currently does (wrapping the response
writer with pooled VelocityWriters) or to just directly use the
response's writer.  If you are concerned about it, then you should
test the performance of both and choose which works best for your
application.

On 1/4/07, John <[EMAIL PROTECTED]> wrote:
> This may be a newbie question, but I'm trying to figure out which of the
> following two methods is better for performing the template merge and
> outputting it in a servlet?
>
> Using the HttpServletResponse's Writer object?
>
>         Writer writer = response().getWriter();
>         template.merge(context, writer);
>         writer.close();
>
> OR
>
> the VelocityViewServlet way with the WriterPool and VelocityWriter?
>
>             vw = (VelocityWriter) writerPool.get();
>
>             if (vw == null)
>             {
>                 vw = new VelocityWriter( new OutputStreamWriter(output,
> encoding), 4*1024, true);
>             }
>             else
>             {
>                 vw.recycle(new OutputStreamWriter(output, encoding));
>             }
>
>             template.merge( context, vw);
>
>
>
> Thanks
> John
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to