-1

I am new to Alfresco and using Alfresco 5.2. I started learning it as an ECM and now I can understand the Share interface to some extent. But I need to master Alfresco as a developer, for which I have to nail Web Script. But I am not sure how to progress in this direction. I am not being able to understand where can I use Web Script and how can it help me. Also, I don't know how to write Web Script/JavaScript programs in Alfresco to perform complex operations. I am stuck within all the documentations and tutorials available on the Internet. Any suggestion or advice can help a lot.

  • 1
    As said in the below answers, Jeff Potts tutorial are your way to go : http://ecmarchitect.com/alfresco-developer-series-tutorials/webscripts/tutorial/tutorial.html – Akah Aug 31 '17 at 07:01
  • Please refer : http://www.krutikjayswal.com/2016/10/alfresco-webscript-spring-webscript.html – Krutik Jayswal Aug 31 '17 at 07:53

2 Answers2

3

There are two types of webscripts, Java-Backed and Non-java backed,

The Javascript API exposes a smaller subset of capabilities than the Java Foundation API that's available to Java-backed webscripts, although there are ways to increase what's exposed to Javascript or to expose new custom APIs to Javascript if you like.

The other difference which is useful at certain times, is that with a Java backed webscript you have more control over what parts of the webscript framework are used. E.g. with a JS webscript, you are always obliged to use a template for the "view" (usually Freemarker) so that can be problematic if you want to send back a raw binary content stream, e.g. a document or other non-text based content. With a Java-backed webscript you can define a class that implements the WebScript interface directly or uses AbstractWebscript instead of DeclarativeWebscript. You could also do other things like look at or set request/response headers, cookies or other things that won't have access to using a Javascript controller

Please refer this documentation

Please refer this blog for web-scripts

Vikash Patel
  • 1,328
  • 9
  • 28
  • In some documentations, it is told to use CURL to test the web scripts. What I found out about CURL, that it sends requests and displays the response in the command line and it needs to be installed explicitly in the system to do this job. But I can do the same job in my browser. Then what is the significance of using CURL and what is its advantage over browsers? – Rajalaxmi Mishra Aug 31 '17 at 05:20
  • CURL is a server-side process. This means that it will be called before the page is rendered and has nothing to do with the client's capabilities. Browser base, however, is a client-side call. this means that it will not be executed until the client loads the page. If you're looking to retrieve the information and dump it to the user immediately then CURL is your best bet. If you'd like to do a progressive load (dump the page, then retrieve the content for a "seamless" load to the user) then Browser is the best bet. – Vikash Patel Aug 31 '17 at 07:39
3

Alfresco identifies webscripts by its URLs mentioned in desc.xml file of webscript. Webscripts are used to exchange data between share to repo. There are two types of webscripts share(presentation) and repository (data) webscripts. Some data resides on server(repository) for e.g. (files or users info) and you might want them to be displayed on client side page or you may want to submit data to the server, then there would be specific repository side webscript or API available which provides/accept such data. For that you have to make call(setup communication) from share to repository webscript. For more info please visit http://ecmarchitect.com/alfresco-developer-series-tutorials/webscripts/tutorial/tutorial.html#what-is-the-web-script-framework

and http://ecmarchitect.com/images/articles/alfresco-webscripts/web-script-article.pdf

Kintu Barot
  • 320
  • 2
  • 11