Hello,

I have some java components (@Singleton) that depend on old core. It is
bad, and I'm trying to move away from it, but I'll keep at least one
component like this - my own bridge.

I have this in initialize() of these components:

            ExecutionContext context = execution.getContext();
            this.context = (XWikiContext)
context.getProperty("xwikicontext");
            this.xwiki = this.context.getWiki();

I realize that this worked well in the context of a mono-wiki, but in a
subwiki I wonder if it causes issues.
Here, ExecutionContext relates to the request (user action) at initialize()
time, so I suppose it's a sort of default execution context, related to
main wiki, right ?
So for example when xwiki.getDocument() is called, it looks after a
document in the main wiki - not in the (sub)wiki from which the component
method was called, right ?

Should I just call initialize() at the beginning of every method that needs
a correct context, in order to get a "fresh" execution context related to
correct wiki ?
Or should I pass the context from the script service, adding it as
parameter to all needed methods in my component ?

Thanks,
Jeremie
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to