EventListener DocumentRenamingEvent not working

Hi.
I’m trying to set up an Event Listener on the DocumentRenamingEvent as Wiki Component and can not make it work.
I followed the Tutorial for Writing an Event Listener and my test works when I’m listening to DocumentCreatingEvent, DocumentUpdatingEvent or DocumentDeletingEvent, but not for DocumentRenamingEvent. I’ve tried DocumentRenamedEvent, EntitiesRenamedEvent, DocumentCopiedEvent and DocumentCopyingEvent, too and it doesn’t work either.

My getEvents Method looks like this:

{{groovy}}
import org.xwiki.bridge.event.*
xcontext.method.output.value = [new DocumentRenamingEvent()]
{{/groovy}}

onEvent:

{{groovy}}
def Testpage = xwiki.getDocument("MyTestPage.Child1.WebHome")
    Testpage.setContent("thisisatest")
    Testpage.save("testSaveOnRenaming", true)
{{/groovy}}

Any idea what I’m doing wrong?

1 Like

Anyone an idea?

Regards Simpel

You might want to look at https://extensions.xwiki.org/xwiki/bin/view/Extension/Script%20Component/ which makes it much easier to implement and debug components implemented in wiki pages. It’s also much better for performances.

As my primary problem needing this event listener is solved (How to prevent internal wiki links as url) I will not check your suggestion anymore.

Nevertheless thank you, Simpel