AnsweredAssumed Answered

how to execute script with direct URL?

Question asked by targa2000 on Jan 26, 2010
Latest reply on Jan 27, 2010 by jpfi
How do we execute a script with direct URL?

In Alfresco wiki :

The second way is to use direct URL addressing for a REST-style of execution. The Alfresco web client features a generic 'command' servlet that allows the execution of scripts directly via URLs. This feature allows direct access to scripts and the result of the script is returned as the HTML response stream. See the Command Servlet documentation for more information on this servlet.

In the script command processor section:

Responsible for processing an Alfresco JavaScript through the 'execute' command. The NodeRef supplied as the first 3 arguments of the node specify the script to execute. Optionally an additional NodeRef can be specified to provide a document node context to the script (in addition the parent folder of the document node will then be used as the space context to the script). Returns the result of the script (if any) converted to a string as the HTML response. See the JavaScript API page for more information on the Alfresco JavaScript API.


Any additional URL parameter arguments can be passed to the servlet, they will be collected and supplied to the scripting data-model into an associative JavaScript array object called args. The args object is accessable from the root of the script scope and contains all the URL name/value pairs supplied to the servlet.

Where do we get the coreect NodeRef to execute for a script?