You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Magnus Kvalheim <bm...@inaphone.com> on 2006/07/07 11:41:45 UTC

Inject velocimacros during runtime (request)

Hi all,
I'm using VelocityViewServlet with velocitytools 1.2

I'm working on a web based templating system that relies on velocity for 
generating output.
This is a multiuser system and files are stored in private repositories 
(DB). A custom resourceloader takes care of the file segregation.

I would like for my users to be able to specify velocimacros in a 
configuration-file and have them loaded in request time.
(Just like with the velocimacro.library property in the 
velocity.properties file are loaded for the velocity engine)

I have searched through the sourcecode for a suited place to 'inject' 
the runtime macro files, with no success so far.

I realize that the macro files could be parsed from within a template 
file, but I would like for my users to be able to declare them in a 
configuration file.

Any suggestions would be greatly appreaciated

thanks
magnus

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Inject velocimacros during runtime (request)

Posted by Magnus Kvalheim <bm...@inaphone.com>.
Yes, that's about right ...

Just to clarify - this is what should happen when a request hits webserver.

1. Determine which user the request belongs to, and get user configuration
2. Do request operations
3. 'Inject' user defined macros valid in request scope only.

Just as velocimacros can be defined for the application scope(velocity engine),
I would also like for velocimacros to be defined for the request scope
somehow...

Can you see any way this can be achieved?

best
magnus 

Quoting Will Glass-Husain <wg...@forio.com>:

> I'd like this too.  (or something similar to allow macros to be defined 
> in other files).  It's been a growing demand from our users.  Adding the 
> macros via #parse would be nice for me.  But it sounds like you're 
> looking for some type of event handler allowing the macros to be 
> selected in code.  Is this right?
> 
> WILL
> 
> Magnus Kvalheim wrote:
> > Hi all,
> > I'm using VelocityViewServlet with velocitytools 1.2
> >
> > I'm working on a web based templating system that relies on velocity 
> > for generating output.
> > This is a multiuser system and files are stored in private 
> > repositories (DB). A custom resourceloader takes care of the file 
> > segregation.
> >
> > I would like for my users to be able to specify velocimacros in a 
> > configuration-file and have them loaded in request time.
> > (Just like with the velocimacro.library property in the 
> > velocity.properties file are loaded for the velocity engine)
> >
> > I have searched through the sourcecode for a suited place to 'inject' 
> > the runtime macro files, with no success so far.
> >
> > I realize that the macro files could be parsed from within a template 
> > file, but I would like for my users to be able to declare them in a 
> > configuration file.
> >
> > Any suggestions would be greatly appreaciated
> >
> > thanks
> > magnus
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
> 
> -- 
> Forio Business Simulations
> 
> Will Glass-Husain
> phone (415) 440-7500 x89
> mobile (415) 235-4293
> wglass@forio.com
> www.forio.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
> 




----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: Inject velocimacros during runtime (request)

Posted by Will Glass-Husain <wg...@forio.com>.
I'd like this too.  (or something similar to allow macros to be defined 
in other files).  It's been a growing demand from our users.  Adding the 
macros via #parse would be nice for me.  But it sounds like you're 
looking for some type of event handler allowing the macros to be 
selected in code.  Is this right?

WILL

Magnus Kvalheim wrote:
> Hi all,
> I'm using VelocityViewServlet with velocitytools 1.2
>
> I'm working on a web based templating system that relies on velocity 
> for generating output.
> This is a multiuser system and files are stored in private 
> repositories (DB). A custom resourceloader takes care of the file 
> segregation.
>
> I would like for my users to be able to specify velocimacros in a 
> configuration-file and have them loaded in request time.
> (Just like with the velocimacro.library property in the 
> velocity.properties file are loaded for the velocity engine)
>
> I have searched through the sourcecode for a suited place to 'inject' 
> the runtime macro files, with no success so far.
>
> I realize that the macro files could be parsed from within a template 
> file, but I would like for my users to be able to declare them in a 
> configuration file.
>
> Any suggestions would be greatly appreaciated
>
> thanks
> magnus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

-- 
Forio Business Simulations

Will Glass-Husain
phone (415) 440-7500 x89
mobile (415) 235-4293
wglass@forio.com
www.forio.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org