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]