Hi Vincent, I've solved the "save files" problem with absolute paths and it works, however I've another problem, this time with the Velocity macro inside a wiki page. This is the exception that I've got: *org.xwiki.rendering.macro.MacroExecutionException: Failed to evaluate Velocity Macro for content [#if("$!request.evolver" == 1) ## Request for creating a new instance ##$services.evoS.parseBPXML('Home','BSS Rome') $services.evoS.removeInstance('Take bike') ##$response.sendRedirect($xwiki.getURL('Main.WebHome')) #else #end {{html}} <form action="" id="newEvolution" method="POST"> <div> <input type="hidden" name="evolver" value="1"/> <span class="buttonwrapper"> <input type="submit" value="Evolve" class="button"/> </span> </div> </form> {{/html}}] at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:131) at org.xwiki.rendering.internal.macro.velocity.VelocityMacro.evaluateString(VelocityMacro.java:50) at org.xwiki.rendering.macro.script.AbstractScriptMacro.evaluateBlock(AbstractScriptMacro.java:286) at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:182) at org.xwiki.rendering.macro.script.AbstractScriptMacro.execute(AbstractScriptMacro.java:58) at org.xwiki.rendering.internal.transformation.macro.MacroTransformation.transform(MacroTransformation.java:269) at org.xwiki.rendering.internal.transformation.DefaultRenderingContext.transformInContext(DefaultRenderingContext.java:183) at org.xwiki.rendering.internal.transformation.DefaultTransformationManager.performTransformations(DefaultTransformationManager.java:95) at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:253) at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:126) at org.xwiki.display.internal.DocumentContentDisplayer.display(DocumentContentDisplayer.java:56) at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:96) at org.xwiki.display.internal.DefaultDocumentDisplayer.display(DefaultDocumentDisplayer.java:39) at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:113) at org.xwiki.sheet.internal.SheetDocumentDisplayer.display(SheetDocumentDisplayer.java:50) at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:68) at org.xwiki.display.internal.ConfiguredDocumentDisplayer.display(ConfiguredDocumentDisplayer.java:42) at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1164) at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1127) at com.xpn.xwiki.doc.XWikiDocument.getRenderedContent(XWikiDocument.java:1179) at com.xpn.xwiki.api.Document.getRenderedContent(Document.java:692) at sun.reflect.GeneratedMethodAccessor403.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280) at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:567) at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)* *...etc etc* You can find in the attachments the Tree structure of my wiki, pages inside "BSS Rome" space are all terminal pages. Thank you for your help, Giordano. 2015-12-26 13:03 GMT+01:00 [email protected] <[email protected]>:
Hi Giordano,
On 23 Dec 2015 at 19:40:11, Giordano Ninonà ([email protected] (mailto:[email protected])) 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#HCompo...
2015-12-23 16:59 GMT+01:00 [email protected](mailto:[email protected]) :
On 23 Dec 2015 at 16:56:20, Giordano Ninonà ([email protected]
(mailto:[email protected])(mailto:[email protected])) 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 < [email protected](mailto:[email protected] )>:
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/...)
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 [email protected](mailto: [email protected]) : > > > Hi Giordano, > > > > On 21 Dec 2015 at 15:20:55, Giordano Ninonà ( [email protected](mailto:[email protected]) > > (mailto:[email protected])) 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 > [email protected](mailto:[email protected]) > http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ users mailing list [email protected](mailto:[email protected]) http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected](mailto:[email protected]) http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected](mailto:[email protected]) http://lists.xwiki.org/mailman/listinfo/users