On Thu, Dec 18, 2008 at 6:27 PM, Thomas Mortagne <[email protected]> wrote: > On Thu, Dec 18, 2008 at 5:38 PM, Juergen Lorenz Simon <[email protected]> > wrote: >> Hi, >> >> On 18.12.2008, at 15:08, Thomas Mortagne wrote: >> >>> On Thu, Dec 18, 2008 at 3:03 PM, Juergen Lorenz Simon <[email protected] >>> > wrote: >>>> Hi, >>>> >>>> On 18.12.2008, at 14:37, Thomas Mortagne wrote: >>>> >>>>> On Thu, Dec 18, 2008 at 1:54 PM, Juergen Lorenz Simon <[email protected] >>>>>> wrote: >>>>>> Hi Thomas, >>>>>> >>>>>> no, I do not create a context myself. I'm running this in Eclipse >>>>> >>>>> But where do you get the XWikiContext you give to >>>>> createExternalURL() ? >>>> >>>> >>>> When the indexing plugin is instantiated I grab the context: >>>> >>>> public IndexUpdater(XWiki wiki, XWikiContext context) { >>>> this.xwiki = wiki; >>>> this.context = context; >>>> } >>>> >>>> Which is obtained from XWiki at plugin initialization time: >>>> >>>> public void init(XWikiContext context) { >>>> ... >>>> // initialize the actual plugin >>>> indexUpdater = new IndexUpdater(context.getWiki(), context); >>>> indexUpdater.start(); >>>> >>>> // Hook into the document change notifications >>>> DocChangeRule docChangeRule = new DocChangeRule(indexUpdater); >>>> >>>> context >>>> .getWiki().getNotificationManager().addGeneralRule(docChangeRule); >>>> } >>>> >>>> Do you think I should use the context that comes in the notify() >>>> method instead? >>> >>> No need, even if it's cleaner but it should be exactly the same java >>> object I think, so I don't understand why your context's request >>> object is wrong. >>> Could you send you full stack trace ? >> >> >> Of course. But it's exactly as it was: >> >> java.lang.NullPointerException >> at com.xpn.xwiki.XWiki.getServletPath(XWiki.java:4317) >> at >> com >> .xpn >> .xwiki >> .web.XWikiServletURLFactory.addServletPath(XWikiServletURLFactory.java: >> 208) >> at >> com >> .xpn >> .xwiki >> .web.XWikiServletURLFactory.createURL(XWikiServletURLFactory.java:178) >> at com.xpn.xwiki.doc.XWikiDocument.getURL(XWikiDocument.java:884) >> at com.xpn.xwiki.doc.XWikiDocument.getURL(XWikiDocument.java:898) >> at com.xpn.xwiki.doc.XWikiDocument.getURL(XWikiDocument.java:903) >> at >> com >> .kontrast >> .vodafone >> .portal >> .xwiki.plugins.indexer.IndexUpdater.runMainLoop(IndexUpdater.java:192) >> at >> com >> .kontrast >> .vodafone >> .portal.xwiki.plugins.indexer.IndexUpdater.run(IndexUpdater.java:118) >> > > You should have more than that, who is calling IndexUpdater.run() ?
Don't listen to me I answered too quickly :) > >> >> this fails also, well, it returns null: >> >> String currentServletpath = context.getRequest().getServletPath(); >> >> any more ideas? We need the external URL so we can point to Wiki pages >> from the index. I could maybe wing it together by constructing the url >> in some other way, using the host name from confifuration and some >> elaborated guessing on the URL, but that would be brittle and >> unpleasant to maintain. >> >> J. >> >> _______________________________________________ >> devs mailing list >> [email protected] >> http://lists.xwiki.org/mailman/listinfo/devs >> > > > > -- > Thomas Mortagne > -- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

