AnsweredAssumed Answered

Download content by uuid with streaming

Question asked by spilby on Aug 4, 2014
Latest reply on Aug 11, 2014 by spilby
I want to download content from alfresco by the uuid of the node. This content may be a big file, bigger than 500MB.

What's the best way to download large contents with streaming? Using the DownloadContentServlet? Or implementing a java backed webscript doing something like this:


ContentReader contentReader = contentService.getReader(actionedUponNodeRef, ContentModel.PROP_CONTENT);
InputStream is = contentReader.getContentInputStream();
BufferedReader br= new BufferedReader(new InputStreamReader (is));


Or is more efficient another way? What's your opinion? May be a lot of users downloading contents, is the reason I want something with streaming, to not crash down the server with simultaneous downloads.

And if I use the DownloadContentServlet, how can I call it? This is the url I found to use it:


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


I must do a HttpClient call on a servlet to this url to download it? Is the same url than if I do this?


Content[] content = WebServiceFactory.getContentService().read(new Predicate(new Reference[]{fileRef}, STORE, null) , "{http://www.alfresco.org/model/content/1.0}content" );
String url = content[0].getUrl();


Or what's the difference? I don't understand these different ways…

Thank you very much!

Outcomes