If you are working with
Alfresco, you may already know what web scripts are. Basically web script framework is a thin
REST layer on top of repository and the web scripts are the
RESTful services that runs inside this framework.
Web scripts are the services that allows you to interact with the repository and it is obvious that they should be documented properly for proper collaboration. Alfresco already has another web script to dump all the web scripts available in the system as
wikimedia but not in confluence format. So I created a new
freemarker template to render the documentation as confluence content. See the following snippet.
All you have to do is to make this template available for that particular web script; means putting it to a proper place so that the web script framework can pick it up while rendering the output. You can put it on the classpath or directly in repository. See the following list for the possible locations.
- repository folder: /Company Home/Data Dictionary/Web Scripts Extensions
- repository folder: /Company Home/Data Dictionary/Web Scripts
- class path folder: /alfresco/extension/templates/webscripts
- class path folder: /alfresco/templates/webscripts
Don’t forget to put the template in the proper package, the package of this webscript is
indexall.get.text.ftl as the template name. See the all possible template paths below.
- repository folder: /Company Home/Data Dictionary/Web Scripts/indexall.get.text.ftlExtensions/com/springframework/extensions/webscripts
- repository folder: /Company Home/Data Dictionary/Web Scripts/org/springframework/extensions/webscripts/indexall.get.text.ftl
- class path folder: /alfresco/extension/templates/webscripts/org/springframework/extensions/webscripts/indexall.get.text.ftl
- class path folder: /alfresco/templates/webscripts/org/springframework/extensions/webscripts/indexall.get.text.ftl
You can invoke this web script via calling
/alfresco/service/index/all.text. If you want to generate the documentation only for the web scripts developed by you, just include the package while calling otherwise it will generate the documentation for all the web scripts, e.g.
After calling the service you can just copy the output and paste into your confluence page.
UPDATE: There are other webscripts in Alfresco source code that can be extended in the same way. However this particular webscript comes with Spring Surf API (
spring-webscripts-api) –which is not in Alfresco source code– because of the Spring adoption of webscript api.