AnsweredAssumed Answered

Create Java back webscript in share extesion project

Question asked by djaweid_ on Jul 8, 2016
Latest reply on Oct 6, 2016 by jpotts
Hi All,

I am new with alfresco. I have created a share extension where I want to create a Java backed webscript.

I used https://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples to create Java backed webscript.


Add the following bean in custom-slingshot-application-context.xml

<bean id="webframework.store.webscripts.custom" class="org.alfresco.web.scripts.ClassPathStore">

      <property name="mustExist"><value>true</value></property>

      <property name="classPath"><value>config/alfresco/web-extension/site-webscripts</value></property>

</bean>


http://127.0.0.1:8081/share/service/com/retreive-data/simple


I get the following error:

retreive-data-share/target/amp-war/WEB-INF/lib/retreive-data-share-1.0-SNAPSHOT.jar!/alfresco/web-extension/custom-slingshot-application-context.xml]; nested exception is java.lang.ClassNotFoundException: org.alfresco.web.scripts.ClassPathStore

Caused by: java.lang.ClassNotFoundException: org.alfresco.web.scripts.ClassPathStore

/src/main/amp/config/alfresco/web-extension/site-webscripts/com/retreive-data/simple.get.desc.xml

<webscript>
  <shortname>The World's Simplest Webscript</shortname>
  <description>Hands back a little bit of JSON</description>
  <url>/com/tenthline/retreive-data/simple</url>
  <authentication>none</authentication>
  <format default="">argument</format>
  <family>Alfresco Java-Backed WebScripts Demo</family>
</webscript>


/src/main/amp/config/alfresco/web-extension/site-webscripts/com/retreive-data/simple.get.json.ftl

<#escape x as jsonUtils.encodeJSONString(x)>

{

   "field1": "${field1}"

}

</#escape>



And also the there are xml files, I dont know where could I use them for Java Backed webscript

/src/main/amp/config/alfresco/web-extension/monitor-websites-share-slingshot-application-context.xml

/src/main/resources/alfresco/web-extension/custom-slingshot-application-context.xml

/src/main/resources/alfresco/web-extension/share-config-custom.xml.sample

/src/main/resources/META-INF/share-config-custom.xml.sample

Thanks advance for your help

dj

Outcomes