You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ron Chan <rc...@i-tao.com> on 2003/09/12 15:25:42 UTC

mulitple contexts

I have multple webapps running on my application server (jboss-3.2.1)

they all run fine with webwork+velocity, with their own velocity context
serving .vm files from within the individual webapps

I need to setup some 'backend' beans running on a schedule that need to send
emails

I'd like to use velocity templates to build the email contents, however it
seems that if I create a velocity context outside (one level above) my
webapps, it also affects the velocity contexts in my webapps.  I suspect
this is because Velocity.init calls RuntimeSingleton.init - therefore only
one singleton will be created.

Is this the correct behavior?

Is there anyway around this?

Can I use velocity without creating a context?  rather like transforming XML
using XSL where I just need to tell it which is the input file which is the
stylesheet and where to send the output


RE: mulitple contexts

Posted by Ron Chan <rc...@i-tao.com>.
thanks!

interesting what you can find out when you actually read the manuals ;-)


> -----Original Message-----
> From: Simon Christian [mailto:simon@stoutstick.com]
> Sent: 12 September 2003 17:12
> To: Velocity Users List
> Subject: Re: mulitple contexts
>
>
> Ron,
>
> That is the 'correct' behaviour in the sense that it's how a Singleton
> will behave, but that's a moot point. What you're after is the
> VelocityEngine, which offers essentially the same functionality as
> Velocity but runs as a separate instance - see:
>
> http://jakarta.apache.org/velocity/developer-guide.html#Separate
>
> - simon
>
>
>
> Ron Chan wrote:
> > I have multple webapps running on my application server (jboss-3.2.1)
> >
> > they all run fine with webwork+velocity, with their own velocity context
> > serving .vm files from within the individual webapps
> >
> > I need to setup some 'backend' beans running on a schedule that
> need to send
> > emails
> >
> > I'd like to use velocity templates to build the email contents,
> however it
> > seems that if I create a velocity context outside (one level above) my
> > webapps, it also affects the velocity contexts in my webapps.  I suspect
> > this is because Velocity.init calls RuntimeSingleton.init -
> therefore only
> > one singleton will be created.
> >
> > Is this the correct behavior?
> >
> > Is there anyway around this?
> >
> > Can I use velocity without creating a context?  rather like
> transforming XML
> > using XSL where I just need to tell it which is the input file
> which is the
> > stylesheet and where to send the output
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>


Re: mulitple contexts

Posted by Simon Christian <si...@stoutstick.com>.
Ron,

That is the 'correct' behaviour in the sense that it's how a Singleton 
will behave, but that's a moot point. What you're after is the 
VelocityEngine, which offers essentially the same functionality as 
Velocity but runs as a separate instance - see:

http://jakarta.apache.org/velocity/developer-guide.html#Separate

- simon



Ron Chan wrote:
> I have multple webapps running on my application server (jboss-3.2.1)
> 
> they all run fine with webwork+velocity, with their own velocity context
> serving .vm files from within the individual webapps
> 
> I need to setup some 'backend' beans running on a schedule that need to send
> emails
> 
> I'd like to use velocity templates to build the email contents, however it
> seems that if I create a velocity context outside (one level above) my
> webapps, it also affects the velocity contexts in my webapps.  I suspect
> this is because Velocity.init calls RuntimeSingleton.init - therefore only
> one singleton will be created.
> 
> Is this the correct behavior?
> 
> Is there anyway around this?
> 
> Can I use velocity without creating a context?  rather like transforming XML
> using XSL where I just need to tell it which is the input file which is the
> stylesheet and where to send the output
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>