How to use Web Script in Alfresco as a developer?

1.2k views Asked by At

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.

2

There are 2 answers

2
Vikash Patel On

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

0
Kintu Barot On

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