I'm going on vacation for a week starting tomorrow, but when I get back, I'll see what I can come up with. For now, whatever I have, I'll put onto my Jira issue. There was a reply about using interceptors for this, but for now I'll take a look at other possibilities, such as subclassing. The tricky thing is (if I recall correctly), the VelocityManager is a singleton, which makes subclassing difficult. Any ideas on what the preferred way would be to achieve similar functionality without going the singleton route?
Possibilities: 1) Move the velocity stack building code out of the manager and back into the servlet, which can be subclassed easily. This is how it was done in ww1. Any implications? 2) Make the velocity manager a ww component. I don't think this is the best idea, because there may be lifecycle issues (when the component gets initialized vs. when a velocity page is just trying to use the velocity servlet without webwork) 3) Initialize the velocity manager as an attribute of the servlet. It would still be available throughout webwork, and the servlet could use it without using webwork. This way, you could specify a velocity manager implementation class as a servlet init param. This feels weird, but it's an idea. Thoughts? Comments? This is all based on the last time I looked at the velocity code, which was something like 2 months ago, and may be painfully out of date. Drew -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Patrick Lightbody Sent: Wednesday, October 15, 2003 8:16 AM To: [EMAIL PROTECTED] Subject: RE: [OS-webwork] Adding Velocity Tools support Drew, if you can help us out on this (we're swamped!) that would be really awesome. In fact, if anyone can help us with any of the open issues that would be really helpful. :) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Drew McAuliffe Sent: Tuesday, October 14, 2003 10:17 AM To: [EMAIL PROTECTED] Subject: RE: [OS-webwork] Adding Velocity Tools support This goes back to a JIRA issue I filed about the VelocityManager and the velocity servlet. Before, in ww1, you could subclass the velocity servlet and add things you wanted to the velocity context. Now, you can't, because of the way the VelocityManager is set up. It would be (still!) great if it were refactored in such a way as to make it easy for people to swap in their own extension, adding items to the context as needed. I can take a look at this, if need be. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dag Liodden Sent: Tuesday, October 14, 2003 4:40 AM To: [EMAIL PROTECTED] Subject: Re: [OS-webwork] Adding Velocity Tools support Aapo Laakkonen wrote: >>1. Add a generic ToolBoxInterceptor to parse the toolbox.xml-file from >>Velocity Tools 2. >>Just use the bean tag in a VelociMacro >> >> > >My solution: > >1. Generic Filter implementation. Then the tools do not only work with >Velocity, but also with every other templating technology. Oh, I forget >that you are using ValueStack instead of page, request, session and >servlet context attributes, and that propably needs a separate >implementation. > > > Yup, I want to call e.g $datetool.format($blah) directly in Velocity. Still, I don't know how to put things in this context without adding it to an action superclass or in the VelocityManager. It should preferrably be done from an interceptor... Jason? Dag ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Opensymphony-webwork mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork