Hi devs,
I'd need to access an instance of ExecutionContext from a Servlet within
XWiki in order to perform XWiki operations from there (query, storage
etc.). So far I tried to follow the same approach as the one I found in
the XWikiRestetServlet :
- XWikiRestletServlet.java
http://bit.ly/TDcoQz
- Utils.java
http://bit.ly/UfNWa6
i.e. something like this:
ComponentManager componentManager = (ComponentManager)
getServletContext().getAttribute("org.xwiki.component.manager.ComponentManager");
Execution execution = componentManager.getInstance(Execution.class);
ExecutionContext ec = execution.getContext();
XWikiContext xwikiContext = (XWikiContext) ec.getProperty("xwikicontext");
XWiki xwiki = xwikiContext.getWiki();
Unfortunately, while a proper Execution object is obtained indeed, the
returned ExecutionContext remains desperately null. Do you see any
configuration or annotation that may be missing ?
Another option I guess would be to lookup dedicated components for
performing the queries and storage directly without going through an
XWikiContext instance, but then what would be the proper way to discover
all the components that are available from the ComponentManager (esp.
query / storage) ?
Regards,
Stéphane
--
Ubimix - Give a new life to your content!
http://ubimix.com
Twitter: @ubimix