<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Command servlet in 5.0.2 in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/command-servlet-in-5-0-2/m-p/310970#M264100</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since this is one of the first hits when searching for a solution to this problem, I'll add another answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found the approach of building a generic content stream webscript (described &lt;A href="https://serverfault.com/questions/694679/how-to-execute-server-side-javascript-via-alfresco-share" rel="nofollow noopener noreferrer"&gt;in this post&lt;/A&gt; on ServerFault) very convenient. In Data Dictionary/Web Script Extensions create a folder for your webscript, e.g. under it/myorganization/jsrunner, and in this folder create a descriptor, e.g. jsrunner.get.desc.xml, with the following content:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;webscript kind="org.alfresco.repository.content.stream"&amp;gt;&lt;BR /&gt;     &amp;lt;shortname&amp;gt;Run script&amp;lt;/shortname&amp;gt;&lt;BR /&gt;     &amp;lt;description&amp;gt;Webscript to execute a repository script&amp;lt;/description&amp;gt;&lt;BR /&gt;     &amp;lt;url&amp;gt;/jsrun&amp;lt;/url&amp;gt;&lt;BR /&gt;     &amp;lt;format default=""&amp;gt;extension&amp;lt;/format&amp;gt;&lt;BR /&gt;     &amp;lt;family&amp;gt;myorganization&amp;lt;/family&amp;gt;&lt;BR /&gt;     &amp;lt;authentication&amp;gt;user&amp;lt;/authentication&amp;gt;&lt;BR /&gt;     &amp;lt;transaction&amp;gt;required&amp;lt;/transaction&amp;gt; &lt;BR /&gt;&amp;lt;/webscript&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then create jsrunner.get.js:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;// in this example we write the log directly in Company Home, YMMV&lt;BR /&gt;var log_node = companyhome.childByNamePath('jsrunner.log') ; &lt;BR /&gt;companyhome.removeNode(log_node) ; &lt;BR /&gt;var log_node= companyhome.createNode('jsrunner.log', 'cm:content') ;&lt;BR /&gt;var log_text = '' ;  &lt;BR /&gt;&lt;BR /&gt;// your code goes here, append to log_text some useful messages&lt;BR /&gt;&lt;BR /&gt;log_node.content = log_text ; &lt;BR /&gt;model.contentNode = log_node ;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to refresh the webscripts once (from /alfresco/s/index), then you can change the js code and execute it again with no need to refresh. I had no need to add parameters to the webscript, but that is also quite straightforward. I think this approach is more flexible than the old execute command servlet.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Feb 2019 10:07:01 GMT</pubDate>
    <dc:creator>fmstasi</dc:creator>
    <dc:date>2019-02-18T10:07:01Z</dc:date>
    <item>
      <title>Command servlet in 5.0.2</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/command-servlet-in-5-0-2/m-p/310965#M264095</link>
      <description>Hi all,I'm trying to use the command servlet to execute database scripts in Alfresco 5.0.2 like so:http://localhost:8080/alfresco/command/script/execute/workspace/SpacesStore/dcf5c20c-5bef-411c-95f0-5fcae72ea25bHowever, this functionality seems to have disappeared in Alfresco 5. The wiki doesn't see</description>
      <pubDate>Tue, 17 Nov 2015 10:35:32 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/command-servlet-in-5-0-2/m-p/310965#M264095</guid>
      <dc:creator>matthewpatin</dc:creator>
      <dc:date>2015-11-17T10:35:32Z</dc:date>
    </item>
    <item>
      <title>Re: Command servlet in 5.0.2</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/command-servlet-in-5-0-2/m-p/310966#M264096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can't.&amp;nbsp;&amp;nbsp; It was part of the old Alfresco Explorer interface which no longer exists.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Nov 2015 15:31:18 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/command-servlet-in-5-0-2/m-p/310966#M264096</guid>
      <dc:creator>mrogers</dc:creator>
      <dc:date>2015-11-17T15:31:18Z</dc:date>
    </item>
    <item>
      <title>Re: Command servlet in 5.0.2</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/command-servlet-in-5-0-2/m-p/310967#M264097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It makes sense that it's gone. The thing is, developing repository scripts without it is a nightmare. The only alternative I have for now is creating a fake folder that runs the script when I copy up a file.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you recommend an easier way to execute repository webscripts? Or is that as "agile" as possible?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, how open would development be to porting the servlet (or something similar) to Share? Was the functionality something that was consciously left out? Or was it just a side effect of abandoning the old client?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Matthew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Nov 2015 10:15:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/command-servlet-in-5-0-2/m-p/310967#M264097</guid>
      <dc:creator>matthewpatin</dc:creator>
      <dc:date>2015-11-18T10:15:43Z</dc:date>
    </item>
    <item>
      <title>Re: Command servlet in 5.0.2</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/command-servlet-in-5-0-2/m-p/310968#M264098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I found out the same thing at the hard way when our corporation updated from 4.0 to 5.0. Creating the scripts are PITA without the command to execute them from client.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Henry &lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jan 2016 18:59:16 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/command-servlet-in-5-0-2/m-p/310968#M264098</guid>
      <dc:creator>henryh</dc:creator>
      <dc:date>2016-01-11T18:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: Command servlet in 5.0.2</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/command-servlet-in-5-0-2/m-p/310969#M264099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use&amp;nbsp;&lt;A class="link-titled" href="https://github.com/share-extras/js-console" title="https://github.com/share-extras/js-console" rel="nofollow noopener noreferrer"&gt;GitHub - share-extras/js-console: Administration Console component for Alfresco Share, that enables the execution of arb…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2018 13:00:54 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/command-servlet-in-5-0-2/m-p/310969#M264099</guid>
      <dc:creator>jservajean</dc:creator>
      <dc:date>2018-03-26T13:00:54Z</dc:date>
    </item>
    <item>
      <title>Re: Command servlet in 5.0.2</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/command-servlet-in-5-0-2/m-p/310970#M264100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since this is one of the first hits when searching for a solution to this problem, I'll add another answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I found the approach of building a generic content stream webscript (described &lt;A href="https://serverfault.com/questions/694679/how-to-execute-server-side-javascript-via-alfresco-share" rel="nofollow noopener noreferrer"&gt;in this post&lt;/A&gt; on ServerFault) very convenient. In Data Dictionary/Web Script Extensions create a folder for your webscript, e.g. under it/myorganization/jsrunner, and in this folder create a descriptor, e.g. jsrunner.get.desc.xml, with the following content:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;webscript kind="org.alfresco.repository.content.stream"&amp;gt;&lt;BR /&gt;     &amp;lt;shortname&amp;gt;Run script&amp;lt;/shortname&amp;gt;&lt;BR /&gt;     &amp;lt;description&amp;gt;Webscript to execute a repository script&amp;lt;/description&amp;gt;&lt;BR /&gt;     &amp;lt;url&amp;gt;/jsrun&amp;lt;/url&amp;gt;&lt;BR /&gt;     &amp;lt;format default=""&amp;gt;extension&amp;lt;/format&amp;gt;&lt;BR /&gt;     &amp;lt;family&amp;gt;myorganization&amp;lt;/family&amp;gt;&lt;BR /&gt;     &amp;lt;authentication&amp;gt;user&amp;lt;/authentication&amp;gt;&lt;BR /&gt;     &amp;lt;transaction&amp;gt;required&amp;lt;/transaction&amp;gt; &lt;BR /&gt;&amp;lt;/webscript&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then create jsrunner.get.js:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;// in this example we write the log directly in Company Home, YMMV&lt;BR /&gt;var log_node = companyhome.childByNamePath('jsrunner.log') ; &lt;BR /&gt;companyhome.removeNode(log_node) ; &lt;BR /&gt;var log_node= companyhome.createNode('jsrunner.log', 'cm:content') ;&lt;BR /&gt;var log_text = '' ;  &lt;BR /&gt;&lt;BR /&gt;// your code goes here, append to log_text some useful messages&lt;BR /&gt;&lt;BR /&gt;log_node.content = log_text ; &lt;BR /&gt;model.contentNode = log_node ;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need to refresh the webscripts once (from /alfresco/s/index), then you can change the js code and execute it again with no need to refresh. I had no need to add parameters to the webscript, but that is also quite straightforward. I think this approach is more flexible than the old execute command servlet.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2019 10:07:01 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/command-servlet-in-5-0-2/m-p/310970#M264100</guid>
      <dc:creator>fmstasi</dc:creator>
      <dc:date>2019-02-18T10:07:01Z</dc:date>
    </item>
  </channel>
</rss>

