[xwiki-dev] [API] New Api.getContext() method?
Sergiu Dumitriu
sergiu.dumitriu at gmail.com
Fri Feb 2 22:05:23 CET 2007
I think you should reconsider this, if I understood things correctly.
>
> Api.getContext is a method that can be called from any velocity code, and
> the XWikiContext class should NOT be freely available.
>
>
> Right. Ok, so what you're saying is that getContext should be protected
> instead of public?
>
Yep, that's the only solution I found this far.
I thought about this before implementing it but then the Api constructor is
> public and takes a XWikiContext object. Thus I guess what we are really
> saying is that either we should use Context instead of XWikiContext and
> leave everything public or make the constructor and the getContext method
> protected.
>
No, Context is less powerful than XWikiCOntext, and you can't get the
XWikiCOntext from the Context.
BTW c.x.XWiki and c.x.XWikiContext are already available from
> velocity/groovy through c.x.api.XWiki.getWiki() and
> c.x.api.Context.getContext(), but I guess this is not right too and needs
> to be fixed.
>
No, only for users having programming rights.
In summary:
- The Context.getContext() method can be accessed both from the velocity and
java code only by the users having programming rights. It cannot be called
from java without PR.
- The public Api.getContext() method can be freely called from either java
or velocity, regardless of the rights.
- The protected Api.getContext() method can be freely called only from Java.
--
http://purl.org/net/sergiu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xwiki.org/pipermail/devs/attachments/20070202/46171ede/attachment.htm
More information about the devs
mailing list