cancel
Showing results for 
Search instead for 
Did you mean: 

Web Script Which Returns a Repository File

brokenindexfing
Champ in-the-making
Champ in-the-making
Hello All,

Maybe this is a stupid question, but I can't find any examples or documentation of how I would write a very simple web script which would just return a single file that is on the repository. I don't want to display a list of files on the repository, or some other widget-like thing, I want to return the file itself in response to the request. Is that possible? If so, could anyone point me in the right direction?

Many thanks,
brokenindex
3 REPLIES 3

openpj
Elite Collaborator
Elite Collaborator
You don't need to implement a new webscript for this goal.
You can use the DownloadContentServlet to return a file in the response.

You have to perform an HTTP GET request with the following URL:
/alfresco/download/<direct|attach>/<workspace>/<store>/<nodeId>/<filename>

More information here:
http://wiki.alfresco.com/wiki/URL_Addressability#DownloadContentServlet
Hope this helps.

brokenindexfing
Champ in-the-making
Champ in-the-making
Thanks! That is so helpful. Along the same lines, is there a way to return an HTML file such that it would be loaded by the browser making the request, and now downloaded?

-A

brokenindexfing
Champ in-the-making
Champ in-the-making
Ah, I get it, you dictate whether the guestDownload file is downloaded or loaded into the browser with the < attach | direct > option.

/alfresco/download/<direct|attach>/<workspace>/<store>/<nodeId>/<filename>
Thanks again.