On Mon, Dec 19, 2011 at 4:02 PM, Eugen Colesnicov <ecolesnicov(a)gmail.com> wrote:
Thomas Mortagne wrote
What change did you make exactly ? Could you paste your new scripts ?
What error do you get exactly ?
I Attached file with content of my page (contains 2 scripts groovy &
velocity)
http://xwiki.475771.n2.nabble.com/file/n7108420/Sandbox.pEventListener.txt
Sandbox.pEventListener.txt
groovy script ia same to
http://extensions.xwiki.org/xwiki/bin/view/Extension/Title+Post+Processing+….
Only small changes in new title definition (according to my own properties)
and CRITICAL line:
xcontext.put("eventsource",source.getFullName())
If I add this line to this script - event listener stops working ... (no any
changes in a title). I cannot see any error (or I don't know how). I think,
that it is error, because event listener stops working - no any changes in
title of a modified page. I checked java log errors - also not there any
errors ...
Without this line:
xcontext.put("eventsource",source.getFullName())
groovy script works perfectly and also works velocity script (cannot get
value from xcontext, but works).
What do you mean exactly by velocity works ? What this script is doing
is to register a java object created with groovy, your velocity will
never be called when an event is received.
Basically what happen:
* when you view the page: a java listener is created and registered in
groovy and your velocity is executed but onEvent is not called
* when an event is received: onEvent of previously registred java
object is called and nothing else, the script is not executed
So if you need to do something when an event is received you need to
do it fully in the onEvent method.
--
Best regards
Eugen Colesnicov
--
View this message in context:
http://xwiki.475771.n2.nabble.com/Interacting-between-groovy-velocity-scrip…
Sent from the XWiki- Users mailing list archive at
Nabble.com.
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Thomas Mortagne