Vincent, can you detail the best practice to create an XWikiContext? I've done:
XWikiContext xcontext = (XWikiContext) Utils.getComponent(Execution.class).getContext() .getProperty(XWikiContext.EXECUTIONCONTEXT_KEY);
But then I get a context whose URLFactory is null. Is there a better way? thanks in advance Paul Le 24 août 2012 à 16:45, Vincent Massol a écrit :
Is there a way for me to get another context to run in the background?
You need to set up the correct environment in your thread as otherwise all bets are off :)
We do that in lots of places; just to name a few: * The main Servlet thread * Stats * Lucene Updater and Rebuilder * Linkchecker * IRCBot thread
In the future I'd like to have common initialization code that can be easily reused. We have a bit of this already with AbstractXWikiRunnable which are extended by Lucene Updater and Rebuilder threads for example.