Creating a response template
As a rule of thumb for a web script, we have to follow the naming convention as expected by the web script framework in Alfresco. As the web script is supposed to return the response in the JSON and XML formats, we need to create two response templates for the web script. Following the naming conventions, there are two files to be created—contentlocation.get.json.ftl and contentlocation.get.xml.ftl as response templates. Return filesystem_location and size in the response as follows:
To create a JSON response template, create a file named
contentlocation.get.json.ftlthat has the following content:{ "content" : { "filesystem_location" : "${contentFSLocation}", "size" : ${contentSize} } }To create an XML response template, create a file named
contentlocation.get.xml.ftlthat has the following content:<?xml version="1.0" encoding="UTF-8"?> <content> <filesystem_location>${contentFSLocation} </filesystem_location> <size...