You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Rickard <ri...@dreambean.com> on 2002/07/30 14:44:18 UTC
VelocityServlet and getOutputStream
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?
Thanks,
Rickard
--
Rickard Öberg
Senselogic
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: VelocityServlet and getOutputStream
Posted by Rickard <ri...@dreambean.com>.
Geir Magnusson Jr. wrote:
> On 7/30/02 8:44 AM, "Rickard" <ri...@dreambean.com> wrote:
> Because we miss you and wanted you to come back.
I KNEW it!! :-)
> 1) Worries me as you can forget to put back. However, one might argue that
> you take our chances when doing this....
Add "get/return" methods that wrap 'em, add Javadocs "Don't forget to
return the writer or die", and spank those who come to the dev list
saying "my writers aren't pooooled, what's wrong?" and generally ignore
it as it's not exactly *that* worrisome to forget to put it into the
pool. It just works worse.
> 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.
:-) That'd be great. I'm currently working on implementing the Portlet
API (JSR168) and portlets are supposed to use getWriter() in order to
write. Some of my portlets use Velocity (of course), which breaks
everything since ya can't use getOutputStream() and getWriter() at the
same time.
> Thinking about it, if we can keep the writer pool protected, we might as
> well do that, so lets go with #2.
That'd be muchos appreciated.
/Rickard
--
Rickard Öberg
Senselogic
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: VelocityServlet and getOutputStream
Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Geir Magnusson Jr." <ge...@adeptra.com> writes:
> On 7/30/02 1:15 PM, "Daniel Rall" <dl...@finemaltcoding.com> wrote:
>
> > "Geir Magnusson Jr." <ge...@adeptra.com> writes:
> >
> >> On 7/30/02 8:44 AM, "Rickard" <ri...@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 <dl...@finemaltcoding.com>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: VelocityServlet and getOutputStream
Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 7/30/02 1:15 PM, "Daniel Rall" <dl...@finemaltcoding.com> wrote:
> "Geir Magnusson Jr." <ge...@adeptra.com> writes:
>
>> On 7/30/02 8:44 AM, "Rickard" <ri...@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?
--
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: VelocityServlet and getOutputStream
Posted by Daniel Rall <dl...@finemaltcoding.com>.
"Geir Magnusson Jr." <ge...@adeptra.com> writes:
> On 7/30/02 8:44 AM, "Rickard" <ri...@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?
--
Daniel Rall <dl...@finemaltcoding.com>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: VelocityServlet and getOutputStream
Posted by Jon Scott Stevens <jo...@latchkey.com>.
on 7/30/02 8:52 AM, "Geir Magnusson Jr." <ge...@adeptra.com> wrote:
> Anyone care if we change what mergeTemplate() uses?
Nope. Turbine doesn't bother with VelocityServlet...
-jon
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: VelocityServlet and getOutputStream
Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 7/30/02 8:44 AM, "Rickard" <ri...@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?
--
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>