cancel
Showing results for 
Search instead for 
Did you mean: 

Webscript response template

simo2010
Champ in-the-making
Champ in-the-making
Hi,

I want to  implement a distributed ECM Architecture using Alfresco as backend Content server.
The architecture components are:
-A foreign Web Application (view)
-Alfresco 3.2, (Model)
-A Connector (controller/Dispatcher)
the idea behind the connector is to provide more interfaces to other ECM products in the future, but actually it exposes only interface to Alfresco.

The communication between the connector and the web App. will be realized using Servlets, whereas the connector communicates with Alfresco Repo. Server using RESTful webscripts, which generate FreeMarker Responses based on templates (XML, HTM, JSON etc…).

My problem: the connector receive a request from the web app. for example to download ein  file (Doc, PDF, XML ,txt or wathever) and forward that request to a webscript ,possibly costum java backed, but also built-in web scripts in some cases, that web script must send the content back to the connector as File Object that can be appened to a HttpServletResponse Object andsent back to the web app. But i don't know which FreeMarker Template i must use, because the connector act as middleware and therefore, and the webscripts by alfresco assume the the client provide a Browser .

any help.

thanks
1 REPLY 1

openpj
Elite Collaborator
Elite Collaborator
But i don't know which FreeMarker Template i must use, because the connector act as middleware and therefore, and the webscripts by alfresco assume the the client provide a Browser .
You can use the DownloadContentServlet:
http://wiki.alfresco.com/wiki/URL_Addressability#DownloadContentServlet
You can call this servlet using a webscript, and you can do this in Java or in Javascript.

If you need a custom response, you can implement a custom Java-Backed Webscript using an AbstractWebScript implementation that allows you to manage request and response directly without using a FreeMarker template:
http://wiki.alfresco.com/wiki/Java-backed_Web_Scripts_Samples#SimpleWebScript.java

Hope this helps.