Hi Ulf,

I haven't had time to look into this in detail, but I'd try to register the
listener through an Engine lifecycle extension (#1), from there you should
be able to register your listener as soon as the Engine is instantiated.

WikiJSPFilter fires some Page events, but fires them to the running
WikiEngine, so it's there where you should listen to.

WikiEventUtils disappeared long ago, IIRC due to a refactor so that the
jspwiki-event could be extracted to it's own module. Don't remember very
well, but its methods ended up mostly in WiliEventManager


HTH,
juan pablo

#1:
https://jspwiki-wiki.apache.org/Wiki.jsp?page=HowToWriteAnEngineLifecycleExtension


El mié, 22 nov 2023, 10:49, Ulf Dittmer <ulf.ditt...@googlemail.com.invalid>
escribió:

> I also tried
>
>
> WikiEventManager.addWikiEventListener(org.apache.wiki.ui.WikiServletFilter.class,
> new WikiEventListener() {
> ...
>
> but that doesn't get called, either. Does anyone know how that is supposed
> to work?
>
> If I understand https://jspwiki-wiki.apache.org/Wiki.jsp?page=WikiEvent
> correctly, that might need to be done BEFORE WikiServletFilter in
> instantiated, but I don't see how that is possible. But then, I'm not sure
> how accurate that page is - some of the other pages describing event
> handling some out of date.
>
> Thanks,
> Ulf
>
> On Tue, Nov 21, 2023 at 11:10 AM Ulf Dittmer <ulf.ditt...@googlemail.com>
> wrote:
>
> > Hi-
> >
> > I'm trying to get notified whenever a page is delivered by listening to
> > WikiPageEvent.PAGE_DELIVERED events. To that end I implemented a
> > WikiEventListener like this
> >
> > engine.addWikiEventListener(new WikiEventListener() {
> >     @Override
> >         public void actionPerformed (WikiEvent event) {
> >             log.info(event.toString());
> >             if (event instanceof WikiPageEvent) {
> > ...
> >             }
> >         }
> >     });
> > }
> >
> > But the listener is never called with WikiPageEvents. According to
> > https://jspwiki-wiki.apache.org/Wiki.jsp?page=WikiEventUtils (a class
> > which apparently no longer exists) I may have to register the listener
> with
> > WikiServletFilter rather than WikiEngine. How would I go about that?
> >
> > Thanks,
> > Ulf
> >
>

Reply via email to