velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Rall <...@finemaltcoding.com>
Subject Re: VelocityServlet and getOutputStream
Date Thu, 08 Aug 2002 18:48:02 GMT
"Geir Magnusson Jr." <geirm@adeptra.com> writes:

> On 7/30/02 1:15 PM, "Daniel Rall" <dlr@finemaltcoding.com> wrote:
> 
> > "Geir Magnusson Jr." <geirm@adeptra.com> writes:
> > 
> >> On 7/30/02 8:44 AM, "Rickard" <rickard@dreambean.com> wrote:
> >> 
> >>> Hey
> >>> 
> >>> I need to change mergeTemplate() in VelocityServlet so that it uses
> >>> getWriter() instead of getOutputStream() (since I have code later on
> >>> that uses getWriter() and you can't mix). The easiest fix for me would
> >>> be to simply subclass VelocityServlet and implement mergeTemplate() with
> >>> this, but it turns out that the writerPool is private so I can't use that.
> >>> 
> >>> Request:
> >>> 1) Either change the writerPool in VelocityServlet to protected
> >>> 2) Change mergeTemplate() in VelocityServlet to use getWriter in the
> >>> first place
> >>> 
> >>> Either would be ok.
> >>> 
> >>> Is there any reason in particular why getOutputStream() is used instead
> >>> of getWriter() there?
> >>> 
> >> 
> >> Because we miss you and wanted you to come back.
> >> 
> >> 1) Worries me as you can forget to put back.  However, one might argue that
> >> you take our chances when doing this....
> >> 
> >> 2) Only worries is that not-Rickard will come and say "Hey, you are using
> >> writer an I need the output stream later..", but as we never made any
> >> promises re this, it may be ok.
> >> 
> >> Thinking about it, if we can keep the writer pool protected, we might as
> >> well do that, so lets go with #2.
> >> 
> >> Anyone care if we change what mergeTemplate() uses?
> > 
> > What effect does this have on character encodings?
> 
> Well... In theory, none, as we would do something like
> 
>   req.setContentType()
> 
> Before doing anything.
> 
> However, this is a good question - how will this effect other parts of a
> portlet app? 

Correct me if I'm wrong, but I believe that single any HTTP response
can consist of only a single content type (pretty sure about this),
and that multiple encodings cannot be mixed successfully on a web page
(not quite as sure about this).

If these are valid assumptions, no problems resulting from this change
come to mind.
-- 

Daniel Rall <dlr@finemaltcoding.com>

--
To unsubscribe, e-mail:   <mailto:velocity-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-dev-help@jakarta.apache.org>


Mime
View raw message