To download content stored on Alfresco repository using Java, this is one possible way:

String url = "http://localhost:18080/alfresco/d/a/workspace/SpacesStore/" + attach.getNode_ref() + "/" + attach.getAttach_filename() + "?ticket=" + ticket;
return new ModelAndView("redirect:" + url);

Where getNode_ref() is a method that returns the node reference ID and getAttach_filename() returns the file name. In that case the authentication ticket is attached to the request because the Alfresco guest user is disable.

To view the content instead of dowload it, change the url into:

Download Alfresco content from Java using Spring
Tagged on:         

Leave a Reply