Hi Giordano, Maybe a quicker route for you to understand would be through Script Services [1].
You basically write a java component and then you write a facade (script service) for it which will be exposed to velocity code (that you usually write in a wiki page, executed server side). Your velocity code talks to the service which, in turn, talks to your java component. Sure, you could write all your java code directly in the service, but that`s not a very nice design, since these script services are not really intended to be used in java code (they are intended for scripts -- velocity, groovy, etc.) and, if you would need to re-use your code in java as well, a component is more suited that a script service (so you should do the heavy coding in the component). Finally, you write your wiki page using some velocity that handle the web logic, (e.g. maybe get some request parameters, do some computations, use some script services to perform more complex stuff and thus call java code, do some redirects, etc.) and finally print the html output to the browser that made the request. All of this is also mentioned in our devguide about writing components, maybe you`ve missed it [2]. However, as Marius hinted, the server side operations done in velocity (and the java code called by the velocity scripts) are performed synchronously, so the browser`s request needs to wait until all those operations finish and the html result is outputed. If your application's logic can not afford to wait for such a result to be computed, then you need to go the asynchronous path, with jobs and with interrogating the job`s status, providing progress information until it finishes executing. Hope this helps, Eduard P.S.: We are more than happy to receive help on the documentation side, specially in those places where it's sketchy and hard to understand, so you are encouraged to pitch in (since it's an open wiki where everyone can edit). I guess documentation is just like testing and it's quite a well known fact that developers are not perfect at testing their own code :) ---------- [1] http://extensions.xwiki.org/xwiki/bin/view/Extension/Script+Module [2] http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents#HFromwikipages On Wed, Nov 25, 2015 at 2:00 PM, Giordano Ninonà <[email protected]> wrote: > Thank you Marius for your reply, this is something that I need, but I've > still problems in understanding how to transfer the control from XWiki to > Java then to XWiki again, in particular I can't understand which XWiki API > I should use and how to properly use them on Java. > > Sorry but I am very confused, and it is strange because I fell that it is > not so difficult bu I still don't understand :P > > Regards, > Giordano Ninonà. > > 2015-11-25 12:38 GMT+01:00 Marius Dumitru Florea < > [email protected]>: > > > The operations you want to perform may take some time, depending on the > > number of affected pages, so I wouldn't block the HTML request, triggered > > when you click the button, until the operation is done. Maybe this can > help > > > > > http://platform.xwiki.org/xwiki/bin/view/DevGuide/PerformingAsynchronousTasks > > . > > > > On Wed, Nov 25, 2015 at 12:47 PM, Giordano Ninonà < > > [email protected] > > > wrote: > > > > > Hi Devs, > > > > > > I am a Master Student of Computer Science and of Business Information > > > Systems. I am developing my master thesis project on a case study > coming > > > from Learnpad, unfortunately I have some problems in understanding the > > huge > > > amount of documentation provided by the XWiki website for developers, > > > anyway the idea behind my project is the following: > > > > > > > > > *Starting from a XWiki page, clicking on an hypothetical button, I want > > to > > > be able to start a Java application that will aplly changes to the > XWiki > > > space, that are: * > > > > > > - *Add and remove single or multiple pages to the space;* > > > - *Set the content of the new pages;* > > > - *Modify content of existing pages;* > > > > > > I am wondering because it is not clear, for me, if I need to create a > > > new *extension > > > *or a new *component *or a *macro*(and the differences between them), > how > > > to properly implement a java application for Xwiki or how to start it > > from > > > the Xwiki environment, if it is possible to modify XWiki spaces at > > runtime, > > > or how to associate java object to wiki pages....and stuff like that... > > > > > > I've already read the documentation, checked the existing extension, > > > cheched the Github repository, but it is dispersive, sometimes too > > > technical (with some knowledge taken for granted) and sometimes too > > > general. In the end I am stucked because I don't know how to approach > my > > > problem in this environment. > > > > > > Do you have any suggestion to help me? I need to be put on the right > > truck > > > > > > Kind Regards, > > > Giordano Ninonà. > > > _______________________________________________ > > > devs mailing list > > > [email protected] > > > http://lists.xwiki.org/mailman/listinfo/devs > > > > > _______________________________________________ > > devs mailing list > > [email protected] > > http://lists.xwiki.org/mailman/listinfo/devs > > > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

