velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Lohmann <tlohm...@metaframe.de>
Subject Re: Problems with an EventHandler
Date Tue, 02 Oct 2001 10:24:35 GMT
"Geir Magnusson Jr." wrote:
> 
> Tim Lohmann wrote:
> >
> > "Geir Magnusson Jr." wrote:
> > >
> > > Tim Lohmann wrote:
> > > >
> > > > Hello!
> > > >
> > > > I need an EventHandler for Velocity which occurs everytime when velocity
> > > > needs a reference, an attribut or a method of the context. I have only
> > > > DummyObjects in my context and to work properly I need to know what
> > > > reference, attribute or method Velocity trys to use to give the right
> > > > return value to Velocity.
> > > > I tried to use the ReferenceInsertionEventHandler from the package
> > > > org.apache.velocity.app.event. But this EventHandler does not help me
> > > > enough with my problem.
> > > > Does Velocity has already a solution for my problem? And if so, can
> > > > anyone explain it to me?
> > >
> > > The solution is pretty simple - make your own facade context class that
> > > extends the VelocityContext and delegates all calls to the
> > > VelocityContext methods via super.<method>
> > >
> > > That way you get all the built in goodies of VelocityContext, and can
> > > still monitor all gets and puts.
> > >
> > > geir
> > >
> > > --
> > > Geir Magnusson Jr.                           geirm@optonline.net
> > > System and Software Consulting
> > > Developing for the web?  See http://jakarta.apache.org/velocity/
> > > Be well, do good work, and keep in touch.
> > Thx,
> > but I think I have to discribe the problem more detailed.
> > I need to work with Strings like
> >
> > $a.getB().c.setD($f)
> 
> Ah.  Yep
> 
> >
> > And because of the DummyObjects I do not have for example a Method
> > getB() So I need an Event that occurs everytime in this commandchain
> > when a reference, attribute or method is called. So i can give step by
> > step the right return values to velocity. So the Event has to occur
> > every step when velocity try to interpret a part of this String.
> > Does Velocity have a solution for this problem?
> 
> Not at the moment, but it is possible.  The current events are
> 
> 1) insertion of 'reference value' into the output stream
> 2) RHS of #set is null
> 3) when a method of a context object throws an exception when invoked
> 
> I will take a look to see where we can fit it.
> 
Hi again!

Is a solution for my problem going to be planned to be integrated into
velocity? Or is it already in velocity integrated? If so, please tell me
how I can use it or when it's integrated.
Thx a lot!

Tim Lohmann

Mime
View raw message