You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Will Glass-Husain <wg...@forio.com> on 2002/02/02 22:40:52 UTC
Velocity conflict?
Hi,
I'm thinking about using Velocity (v1.2) in two related servlets, both within the
same context. I want to have different velocity property settings for the servlets
and am wondering if I need to do anything special to keep them distinct.
Specifically, one servlet is based on the Turbine framework, and the other servlet
subclasses VelocityServlet. This is all under Tomcat (deployed on two different
systems using v3.2.3 and v 4).
I know that Velocity used to be a singleton-- is this true for the version used by
VelocityServlet and by Turbine? If Turbine and VelocityServlet both have singleton-
type class level data stored, are they accessing the same class? (My knowledge of
how ClassLoaders work is a little weak).
If they do overlap, I assume I'll need to create my own servlet that makes a runtime
instance of Velocity.
Appreciate any advice. WILL
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Velocity conflict?
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 2/4/02 3:35 PM, "Will Glass-Husain" <wg...@forio.com> wrote:
> Thanks Geir,
>
> Okay, I went and read the coding standards-- I wasn't far off, but this
> (attached) new version is better.
>
>
> Contrib is fine. It wasn't really rocket science to create (just modified
> some existing source), but could be useful to someone else.
Oh clearly.
I wonder if we should do this from the get-go with the -tools/view servlet
instead....
Then you can subclass that instead of VelocityServlet, and it will be in
mainline use. You will also get the toolbox stuff. Hm.
geir
>
> Best,
>
> WILL
>
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Monday, February 04, 2002 12:23 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: Velocity conflict?
>
>
> On 2/4/02 2:04 PM, "Will Glass-Husain" <wg...@forio.com> wrote:
>
>> Hi,
>>
>> I went ahead and altered VelocityServlet to use an instance of velocity,
>> rather than the singleton version of velocity. This will be useful to web
>> app developers using multiple servlets in the same webapp, where different
>> servlets use Velocity with different property settings.
>>
>> I changed the code as little as possible, and called it
>> "VelocityServletAlt". Do you think this might be useful to include in the
>> next distribution as an alternative to VelocityServlet?
>
> Possibly. We'll certainly punch it into contrib for now. Is that ok?
>
>>
>> As this is my first (potential) contribution to the Velocity source, let
> me
>> know what I should do to the following file to package it for inclusion.
>
> Haven't looked at it yet, but the biggies are
>
> 1) License
> 2) Follow project coding convention
> 3) Works vaguely as advertised :)
>
> geir
>
>>
>> Best,
>> WILL
>>
>> -----Original Message-----
>> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
>> Sent: Saturday, February 02, 2002 2:05 PM
>> To: velocity-user@jakarta.apache.org
>> Subject: Re: Velocity conflict?
>>
>>
>> On 2/2/02 4:40 PM, "Will Glass-Husain" <wg...@forio.com> wrote:
>>
>>> Hi,
>>>
>>> I'm thinking about using Velocity (v1.2) in two related servlets, both
>> within
>>> the
>>> same context. I want to have different velocity property settings for
> the
>>> servlets
>>> and am wondering if I need to do anything special to keep them distinct.
>>
>> You will if they are in the same webapp.
>>
>>>
>>> Specifically, one servlet is based on the Turbine framework, and the
> other
>>> servlet
>>> subclasses VelocityServlet. This is all under Tomcat (deployed on two
>>> different
>>> systems using v3.2.3 and v 4).
>>>
>>> I know that Velocity used to be a singleton-- is this true for the
> version
>>> used by
>>> VelocityServlet and by Turbine? If Turbine and VelocityServlet both have
>>> singleton-
>>> type class level data stored, are they accessing the same class? (My
>>> knowledge of
>>> how ClassLoaders work is a little weak).
>>
>> If they are the same webapp, then if they both are using the singleton,
> then
>> yes, you're hosed. (I'm not sure about what Turbine does...)
>>
>> However, there is hope.
>>
>> All you have to do is make a class like VelocityServlet that uses the
>> separate instance where it is now referring to the singleton.
>>
>> VelocityServlet isn't complicated - there are only a few places where you
>> will have to do this...
>>
>> Do that for your own class, and then you don't have to worry about
> turbine.
>>
>>> If they do overlap, I assume I'll need to create my own servlet that
> makes
>> a
>>> runtime
>>> instance of Velocity.
>>
>> Yes.
>>
>>> Appreciate any advice. WILL
>>>
>>
>> I have one floating around. I will post it...
>>
>> --
>> Geir Magnusson Jr. geirm@optonline.net
>> System and Software Consulting
>> "Now what do we do?"
>>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>> --
>> To unsubscribe, e-mail:
>> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
>> <ma...@jakarta.apache.org>
>>
>
> --
> Geir Magnusson Jr. geirm@optonline.net
> System and Software Consulting
> Be a giant. Take giant steps. Do giant things...
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
You're going to end up getting pissed at your software
anyway, so you might as well not pay for it. Try Open Source.
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Velocity conflict?
Posted by Will Glass-Husain <wg...@forio.com>.
Thanks Geir,
Okay, I went and read the coding standards-- I wasn't far off, but this
(attached) new version is better.
Contrib is fine. It wasn't really rocket science to create (just modified
some existing source), but could be useful to someone else.
Best,
WILL
-----Original Message-----
From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
Sent: Monday, February 04, 2002 12:23 PM
To: velocity-user@jakarta.apache.org
Subject: Re: Velocity conflict?
On 2/4/02 2:04 PM, "Will Glass-Husain" <wg...@forio.com> wrote:
> Hi,
>
> I went ahead and altered VelocityServlet to use an instance of velocity,
> rather than the singleton version of velocity. This will be useful to web
> app developers using multiple servlets in the same webapp, where different
> servlets use Velocity with different property settings.
>
> I changed the code as little as possible, and called it
> "VelocityServletAlt". Do you think this might be useful to include in the
> next distribution as an alternative to VelocityServlet?
Possibly. We'll certainly punch it into contrib for now. Is that ok?
>
> As this is my first (potential) contribution to the Velocity source, let
me
> know what I should do to the following file to package it for inclusion.
Haven't looked at it yet, but the biggies are
1) License
2) Follow project coding convention
3) Works vaguely as advertised :)
geir
>
> Best,
> WILL
>
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Saturday, February 02, 2002 2:05 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: Velocity conflict?
>
>
> On 2/2/02 4:40 PM, "Will Glass-Husain" <wg...@forio.com> wrote:
>
>> Hi,
>>
>> I'm thinking about using Velocity (v1.2) in two related servlets, both
> within
>> the
>> same context. I want to have different velocity property settings for
the
>> servlets
>> and am wondering if I need to do anything special to keep them distinct.
>
> You will if they are in the same webapp.
>
>>
>> Specifically, one servlet is based on the Turbine framework, and the
other
>> servlet
>> subclasses VelocityServlet. This is all under Tomcat (deployed on two
>> different
>> systems using v3.2.3 and v 4).
>>
>> I know that Velocity used to be a singleton-- is this true for the
version
>> used by
>> VelocityServlet and by Turbine? If Turbine and VelocityServlet both have
>> singleton-
>> type class level data stored, are they accessing the same class? (My
>> knowledge of
>> how ClassLoaders work is a little weak).
>
> If they are the same webapp, then if they both are using the singleton,
then
> yes, you're hosed. (I'm not sure about what Turbine does...)
>
> However, there is hope.
>
> All you have to do is make a class like VelocityServlet that uses the
> separate instance where it is now referring to the singleton.
>
> VelocityServlet isn't complicated - there are only a few places where you
> will have to do this...
>
> Do that for your own class, and then you don't have to worry about
turbine.
>
>> If they do overlap, I assume I'll need to create my own servlet that
makes
> a
>> runtime
>> instance of Velocity.
>
> Yes.
>
>> Appreciate any advice. WILL
>>
>
> I have one floating around. I will post it...
>
> --
> Geir Magnusson Jr. geirm@optonline.net
> System and Software Consulting
> "Now what do we do?"
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
Be a giant. Take giant steps. Do giant things...
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
Re: Velocity conflict?
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 2/4/02 2:04 PM, "Will Glass-Husain" <wg...@forio.com> wrote:
> Hi,
>
> I went ahead and altered VelocityServlet to use an instance of velocity,
> rather than the singleton version of velocity. This will be useful to web
> app developers using multiple servlets in the same webapp, where different
> servlets use Velocity with different property settings.
>
> I changed the code as little as possible, and called it
> "VelocityServletAlt". Do you think this might be useful to include in the
> next distribution as an alternative to VelocityServlet?
Possibly. We'll certainly punch it into contrib for now. Is that ok?
>
> As this is my first (potential) contribution to the Velocity source, let me
> know what I should do to the following file to package it for inclusion.
Haven't looked at it yet, but the biggies are
1) License
2) Follow project coding convention
3) Works vaguely as advertised :)
geir
>
> Best,
> WILL
>
> -----Original Message-----
> From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
> Sent: Saturday, February 02, 2002 2:05 PM
> To: velocity-user@jakarta.apache.org
> Subject: Re: Velocity conflict?
>
>
> On 2/2/02 4:40 PM, "Will Glass-Husain" <wg...@forio.com> wrote:
>
>> Hi,
>>
>> I'm thinking about using Velocity (v1.2) in two related servlets, both
> within
>> the
>> same context. I want to have different velocity property settings for the
>> servlets
>> and am wondering if I need to do anything special to keep them distinct.
>
> You will if they are in the same webapp.
>
>>
>> Specifically, one servlet is based on the Turbine framework, and the other
>> servlet
>> subclasses VelocityServlet. This is all under Tomcat (deployed on two
>> different
>> systems using v3.2.3 and v 4).
>>
>> I know that Velocity used to be a singleton-- is this true for the version
>> used by
>> VelocityServlet and by Turbine? If Turbine and VelocityServlet both have
>> singleton-
>> type class level data stored, are they accessing the same class? (My
>> knowledge of
>> how ClassLoaders work is a little weak).
>
> If they are the same webapp, then if they both are using the singleton, then
> yes, you're hosed. (I'm not sure about what Turbine does...)
>
> However, there is hope.
>
> All you have to do is make a class like VelocityServlet that uses the
> separate instance where it is now referring to the singleton.
>
> VelocityServlet isn't complicated - there are only a few places where you
> will have to do this...
>
> Do that for your own class, and then you don't have to worry about turbine.
>
>> If they do overlap, I assume I'll need to create my own servlet that makes
> a
>> runtime
>> instance of Velocity.
>
> Yes.
>
>> Appreciate any advice. WILL
>>
>
> I have one floating around. I will post it...
>
> --
> Geir Magnusson Jr. geirm@optonline.net
> System and Software Consulting
> "Now what do we do?"
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
Be a giant. Take giant steps. Do giant things...
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Velocity conflict?
Posted by Will Glass-Husain <wg...@forio.com>.
Hi,
I went ahead and altered VelocityServlet to use an instance of velocity,
rather than the singleton version of velocity. This will be useful to web
app developers using multiple servlets in the same webapp, where different
servlets use Velocity with different property settings.
I changed the code as little as possible, and called it
"VelocityServletAlt". Do you think this might be useful to include in the
next distribution as an alternative to VelocityServlet?
As this is my first (potential) contribution to the Velocity source, let me
know what I should do to the following file to package it for inclusion.
Best,
WILL
-----Original Message-----
From: Geir Magnusson Jr. [mailto:geirm@optonline.net]
Sent: Saturday, February 02, 2002 2:05 PM
To: velocity-user@jakarta.apache.org
Subject: Re: Velocity conflict?
On 2/2/02 4:40 PM, "Will Glass-Husain" <wg...@forio.com> wrote:
> Hi,
>
> I'm thinking about using Velocity (v1.2) in two related servlets, both
within
> the
> same context. I want to have different velocity property settings for the
> servlets
> and am wondering if I need to do anything special to keep them distinct.
You will if they are in the same webapp.
>
> Specifically, one servlet is based on the Turbine framework, and the other
> servlet
> subclasses VelocityServlet. This is all under Tomcat (deployed on two
> different
> systems using v3.2.3 and v 4).
>
> I know that Velocity used to be a singleton-- is this true for the version
> used by
> VelocityServlet and by Turbine? If Turbine and VelocityServlet both have
> singleton-
> type class level data stored, are they accessing the same class? (My
> knowledge of
> how ClassLoaders work is a little weak).
If they are the same webapp, then if they both are using the singleton, then
yes, you're hosed. (I'm not sure about what Turbine does...)
However, there is hope.
All you have to do is make a class like VelocityServlet that uses the
separate instance where it is now referring to the singleton.
VelocityServlet isn't complicated - there are only a few places where you
will have to do this...
Do that for your own class, and then you don't have to worry about turbine.
> If they do overlap, I assume I'll need to create my own servlet that makes
a
> runtime
> instance of Velocity.
Yes.
> Appreciate any advice. WILL
>
I have one floating around. I will post it...
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"Now what do we do?"
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
Re: Velocity conflict?
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
On 2/2/02 4:40 PM, "Will Glass-Husain" <wg...@forio.com> wrote:
> Hi,
>
> I'm thinking about using Velocity (v1.2) in two related servlets, both within
> the
> same context. I want to have different velocity property settings for the
> servlets
> and am wondering if I need to do anything special to keep them distinct.
You will if they are in the same webapp.
>
> Specifically, one servlet is based on the Turbine framework, and the other
> servlet
> subclasses VelocityServlet. This is all under Tomcat (deployed on two
> different
> systems using v3.2.3 and v 4).
>
> I know that Velocity used to be a singleton-- is this true for the version
> used by
> VelocityServlet and by Turbine? If Turbine and VelocityServlet both have
> singleton-
> type class level data stored, are they accessing the same class? (My
> knowledge of
> how ClassLoaders work is a little weak).
If they are the same webapp, then if they both are using the singleton, then
yes, you're hosed. (I'm not sure about what Turbine does...)
However, there is hope.
All you have to do is make a class like VelocityServlet that uses the
separate instance where it is now referring to the singleton.
VelocityServlet isn't complicated - there are only a few places where you
will have to do this...
Do that for your own class, and then you don't have to worry about turbine.
> If they do overlap, I assume I'll need to create my own servlet that makes a
> runtime
> instance of Velocity.
Yes.
> Appreciate any advice. WILL
>
I have one floating around. I will post it...
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
"Now what do we do?"
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>