TitlePlugins called multipul times
Date27-Mar-2005 06:34:14 EEST
Bug criticalityJSPWiki:EnhancementRequest
Browser versionN/A
Bug statusClosedBug
PageProvider used
Servlet ContainerTomcat 5.0.19
Operating SystemLinux
Java version1.4.2

I was attempting to figure out why a plugin I wanted to use - the RSSViewer - was not behaving as I thought it should. I put some system.outs in the execute() method, and discovered that the execute() method is called four times per page request. This seems a bit excessive. Am I missing something?

Well, yes and no. This behaviour is in fact "by design". Several internal parts of the wiki engine use the TranslatorReader to do thier jobs. It of course invokes plugins on a page as it reads and translates. So the multiple invokations are normal and expected. I don't care for this behaviour either. It's okay for trivial plugins that when invoked don't do alot of work, but for more substantial ones... Well this is somehting I'd like to see changed in the future. (This issue gave me fits while I was developing the GraphVizPlugin for about an hour until I realized what was going on.) I'll leave you bug status here unchanged and let Janne decide how to classify this. --JohnV

John, you're right, this is by design. Any plugin implementers should be aware of this behaviour. However, four times, I agree, is too much. For optimization purposes it will be streamlined somewhat in the future.

-- JanneJalkanen

That's interesting; I can't for the life of me figure out why more than once is needed. Chaining is a common pattern, but shouldn't require plugins being called multiple times. What's worse, the plugin developer has no way of knowing which of the four calls generated html will actually be displayed. By adding an incremental counter I determined it was three. However, if I set logic to do work only on the third call, the fourth - as it has no html to output - erases the work of the third!

If you really feel the design is such that multiple invocations are required, do something so that plugin writers can determine when they should actually have to do work, and provide some means of outputting nothing without overwriting what was already done.

-- Silverfields1

Actually the reason is that the current auth scheme is braindead, and it requires multiple reads of the same page to function properly. We're working on it... It's deprecated anyway.

Without authentication (like in the current CVS) each page is only read once.

-- JanneJalkanen

Just downloaded the latest CVS, and it works great! Thanls for the great owrk!


Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-7) was last changed on 19-Jun-2005 14:43 by Administrator