Hi Giordano, On 23 Dec 2015 at 19:40:11, Giordano Ninonà (giordano.nin...@gmail.com(mailto:giordano.nin...@gmail.com)) wrote:
> Thanks Vincent, > > I found everything I need but I got a nullpointer exeptioneverytime I use the > environment.getTemporaryDirectory() method in my code. > I thought it could be the component manager, so I've tried to inizialize it > but I got an error every time I call the method "initialize()", as suggested > in [1] and [2]. If you’re deploying your component inside an XWiki you don’t need to initialize the CM, this is done for you by XWiki. A NPE means you’re missing an @Inject and thus the Environment instance is null. Could you show us your code? Thanks -Vincent > Any ideas why it is not working? > > Thanks, > Giordano > > [1] http://extensions.xwiki.org/xwiki/bin/view/Extension/Environment+Module > [2] > http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HComponentManagerInitialization > > > 2015-12-23 16:59 GMT+01:00 vinc...@massol.net(mailto:vinc...@massol.net) : > > > > > > On 23 Dec 2015 at 16:56:20, Giordano Ninonà > > (giordano.nin...@gmail.com(mailto:giordano.nin...@gmail.com)(mailto:giordano.nin...@gmail.com)) > > wrote: > > > > > Hi users, > > > > > > Thanks for your answers, anyway it wasn't a String problem, and also > > > change > > > to GET doesn't produce anything. Maybe I've found my problem, when I start > > > my component, the very first thing to do is to parse an XML file thus my > > > script service provide a "parseBPXML()" method. The problem is where can i > > > store this file in order to make accessible by my component, I've already > > > Injected the Environment component but I can't understand where to put my > > > file (i.e. which is the "permanent directory") and how to access it. > > > > Check your xwiki.properties file and search for permanentDirectory. > > > > Thanks > > -Vincent > > > > > Thank you, > > > Giordano. > > > > > > 2015-12-23 6:51 GMT+01:00 Marius Dumitru Florea < > > > mariusdumitru.flo...@xwiki.com(mailto:mariusdumitru.flo...@xwiki.com)>: > > > > > > > On Wed, Dec 23, 2015 at 12:30 AM, Ludovic Dubost > > > > wrote: > > > > > > > > > Isn't the problem that it should be > > > > > > > > > > #if("$!request.evolver" == "1") > > > > > > > > > > And not > > > > > > > > > > > > > > > > > > > #if("$!request.evolver" == 1) > > > > > > > > > > > > > I thought so too but I tested and it works. I checked the Velocity > > > > documentation [1] and the explanation is: > > > > > > > > "In the last case (when objects are of different classes), the > > > > toString() > > > > method is called on each object and the resulting Strings are compared." > > > > > > > > Thanks, > > > > Marius > > > > > > > > [1] > > > > > > > > https://click.apache.org/docs/velocity/vtl-reference-guide.html##if/#elseif/#else%20-%20Output%20conditional%20on%20truth%20of%20statements(https://click.apache.org/docs/velocity/vtl-reference-guide.html#%23if/%23elseif/%23else%20-%20Output%20conditional%20on%20truth%20of%20statements) > > > > > > > > > > > > > > > > > > Ludo > > > > > Le 22 déc. 2015 21:32, "Giordano Ninonà" a > > > > > écrit : > > > > > > > > > > > Dear Vincent, > > > > > > > > > > > > Tank you for your reply, I would try what you suggested in the > > > > afternoon, > > > > > > but regarding the "evolver=1 request param", I've set it equal to 1 > > > > > > together with POST command in order to make it always true ensuring > > > > that > > > > > my > > > > > > component is started every time. My thoughts were wrong? > > > > > > > > > > > > Giordano. > > > > > > > > > > > > 2015-12-22 11:31 GMT+01:00 > > > > > > vinc...@massol.net(mailto:vinc...@massol.net) : > > > > > > > > > > > > > Hi Giordano, > > > > > > > > > > > > > > On 21 Dec 2015 at 15:20:55, Giordano Ninonà ( > > > > giordano.nin...@gmail.com(mailto:giordano.nin...@gmail.com) > > > > > > > (mailto:giordano.nin...@gmail.com)) wrote: > > > > > > > > > > > > > > > Hi users, > > > > > > > > > > > > > > > > My project in XWiki consists in a java component which offers > > > > > > > > some > > > > > APIs > > > > > > > > through a script service called by a Velocity script in a wiki > > > > page. > > > > > > > > > > > > > > > > I put my .jar in the directory C:\XWiki Enterprise > > > > > > > > 7.3\*webapps\xwiki\WEB-INF\lib > > > > > > > > *and this is the Velocity and HTML code that I've put in my > > > > > > > > XWiki > > > > > page: > > > > > > > > > > > > > > > > {{velocity}} > > > > > > > > #if("$!request.evolver" == 1) > > > > > > > > ## Request for creating a new instance > > > > > > > > $services.pars.parse() > > > > > > > > $services.evo.removeInstance("Take bike") > > > > > > > > $response.sendRedirect($xwiki.getURL('Main.WebHome')) > > > > > > > > ## Stop processing, since we already sent a redirect. > > > > > > > > #stop > > > > > > > > #end > > > > > > > > > > > > > > [snip] > > > > > > > > > > > > > > > Let first say that nothing is happening when I click on the > > > > "Evolve" > > > > > > > button > > > > > > > > and I don't know why...it looks like it should work, also > > > > > > > > because > > > > > > > creating > > > > > > > > a Main_test class in Eclipse, I can run my software calling > > > > > > > > exactly > > > > > the > > > > > > > > same methods and it works! > > > > > > > > > > > > > > You could use GET instead of POST and see what you get in the URL > > > > > > > (ie > > > > > > > whether you get the evolver=1 request param). > > > > > > > > > > > > > > > Moreover my component must create some files to store some > > > > > information, > > > > > > > > thus I am wondering where to save those files in order to make > > > > > > > > them > > > > > > > > accessible by the component. > > > > > > > > > > > > > > You can use the XWiki’s permanent directory. > > > > > > > > > > > > > > See > > > > > > > > > > > > http://extensions.xwiki.org/xwiki/bin/view/Extension/Environment+Module > > > > > > > > > > > > > > Thanks > > > > > > > -Vincent > > > > > > > > > > > > > > > Any suggestions? > > > > > > > > > > > > > > > > Thanks in advance, > > > > > > > > Giordano. > > > > > > > > > > > > > _______________________________________________ > > > > > > users mailing list > > > > > > users@xwiki.org(mailto:users@xwiki.org) > > > > > > http://lists.xwiki.org/mailman/listinfo/users > > > > > > > > > > > _______________________________________________ > > > > > users mailing list > > > > > users@xwiki.org(mailto:users@xwiki.org) > > > > > http://lists.xwiki.org/mailman/listinfo/users > > > > > > > > > _______________________________________________ > > > > users mailing list > > > > users@xwiki.org(mailto:users@xwiki.org) > > > > http://lists.xwiki.org/mailman/listinfo/users > > > > > > > _______________________________________________ > > > users mailing list > > > users@xwiki.org(mailto:users@xwiki.org) > > > http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users