[xwiki-users] : XWiki context

Vincent Massol vincent at massol.net
Sun Apr 15 11:35:05 CEST 2007


On Apr 13, 2007, at 2:39 PM, Jerome Velociter wrote:

> Hi Youcef,
>
> I can't really help you with your language issue, but I can give  
> some indications on the different contexts.
>
> From Velocity :
>
> $context is the com.xpn.xwiki.api.Context class. It correspond to  
> the request context exposed to xwiki users.
>
> $context.context (or $context.getContext()) is the  
> com.xpn.xwiki.XWikiContext. That is the context not wrapped by the  
> Api.

This getContext() method will be removed in the future and should not  
be used. BTW it can only be used by users with programming rights.  
It's a privileged API.

> Both class have more or less same methods exposed, but for most  
> usages, you should use the $context.
> You may want also to be aware that contexts have a lifespan of one  
> request.

Actually the context stores everything. There are objects that have a  
lifespan of the application and others that have a lifespan of the  
request (like the xwiki request and response object). Jerome is right  
in that the context is updated for each request.

All this should go in the developer guide that I have proposed some  
time back on this list (but got nobody interested in helping out so  
far ;-)).

Thanks
-Vincent

> On 4/13/07, Youcef BEY < youcef.bey at imag.fr> wrote:
> Hi All,
>
> I would like whether someone help me on how to set the language or  
> change the default document language with "Groovy". In some  
> situations, when creating some of documents I don't need to specify  
> language even language of content is different of that indicated on  
> the top.
>
> Now for some documents, I need to create documents for which  
> default language is different from that of XWiki.
>
> In fact, I tried to invoke 'XWikiContext.setLanguage("language")'  
> but it seems that "saveDocument()" method don't work with  
> "XWikiContext".
> I would like also to understand difference between "XWikiContext",  
> "context.context" and "xwiki.api.Context"? If before saving any  
> document we need to specify the "context" then how to modify this  
> context. There are less methods are available for tuning this  
> contex (I mean "context.context").
>
> Many thanks in advance.
>
> Youcef
>
>
> --
> You receive this message as a subscriber of the xwiki- 
> users at objectweb.org mailing list.
> To unsubscribe: mailto: xwiki-users-unsubscribe at objectweb.org
> For general help: mailto: sympa at objectweb.org?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/ 
> wws
>
>
>
>
> -- 
> Jerome Velociter
> Mobile : 0033 (0) 617 260 654
> GTalk, MSN : jerome.velociter at gmail.com
> Skype : jerome.velociter
>
> --
> You receive this message as a subscriber of the xwiki- 
> users at objectweb.org mailing list.
> To unsubscribe: mailto:xwiki-users-unsubscribe at objectweb.org
> For general help: mailto:sympa at objectweb.org?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/ 
> wws

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xwiki.org/pipermail/users/attachments/20070415/402ae1fe/attachment-0001.html 


More information about the users mailing list