Hello, Thanks for directions, works well with servlet context :)
I noticed something, it seems that xwiki does not execute my page (mainly velocity and groovy scripts) more than once at a time. My protection seems useless, if I wget my page a second time, anyway it waits for the first page to be rendered and displayed (my protection is not blocking). I thought maybe it was due to rendering cache : avoid to render twice a page, and prefer to wait to benefit from first page in cache, wich would be logical. But in the case of a fully dynamically generated content, it does not seem useful ... Not sure about that though, BR, Jeremie 2010/2/1 Sergiu Dumitriu <ser...@xwiki.com> > On 02/01/2010 10:41 AM, Jeremie BOUSQUET wrote: > > Thanks Vincent, > > > > You're right it will be easier through context... > > Do "$context" (velocity) and "context" (groovy) variables refer to the > > application context or to the session context ? > > Neither, it's a custom context valid for one request. You can get either > of the session/application context starting from the $request (velocity) > request (groovy) variable, which internally is a HttpServletRequest, > look at its documentation for more details: > > > http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpServletRequest.html > > > Jeremie > > > > 2010/2/1 Vincent Massol<vinc...@massol.net> > > > >> Hi Jeremie, > >> > >> On Feb 1, 2010, at 10:11 AM, Jeremie BOUSQUET wrote: > >> > >>> Hi all, > >>> > >>> I use method parseGroovyFromPage() to instantiate an object from a > Groovy > >>> class stored in a page. > >>> > >>> It works well, but now I would like to forbid multiple executions of > this > >>> class. To do so, I changed it to be a singleton, setting the > constructor > >> as > >>> private. > >>> Of course, now, parseGroovyFromPage() returns that the object can't be > >>> instantiated ... As the call to the constructor is inside this method, > I > >>> can't change it to just call getInstance(). > >>> > >>> Are there any workarounds, or other ways to achieve this ? > >> > >> Why do you need to use this method? > >> > >> With XWiki Syntax 2.0 we now have the ability to do: > >> > >> {{include document="groovypage"/}} > >> > >> where groovypage is a page using the {{groovy}} macro to define groovy > >> code. > >> > >> If you want to forbid several executions of the {{groovy}} script you > could > >> use an if() inside it and check if a value is present in the session or > >> application context (depending if you want it called once per user or > per > >> application). > > -- > Sergiu Dumitriu > http://purl.org/net/sergiu/ > _______________________________________________ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users