08-03-2010 02:53 PM
ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
Reference contentReference = new Reference(storeRef,uuid,null);
readResult = contentService.read(new Predicate(new Reference[]{contentReference}, storeRef, null), Constants.PROP_CONTENT);
is = ContentUtils.getContentAsInputStream(readResult[0]);
return is;AlfrescoBridge bridge = new AlfrescoBridge(); // my handy class
InputStream in = bridge.getFileInputStream(uuid); // method above
response.reset();
response.setHeader ("Content-Disposition", "attachment;filename=\""+fileName+"\"");
ServletOutputStream sosStream = response.getOutputStream();
int ibit = 256;
while ((ibit) >= 0) {
ibit = in.read();
sosStream.write(ibit);
}
sosStream.flush();
sosStream.close();
in.close();
08-03-2010 07:31 PM
08-04-2010 02:43 PM
AlfrescoBridge bridge = new AlfrescoBridge(); // my handy class again
response.reset();
response.setHeader ("Content-Disposition", "attachment;filename=\""+fileName+"\"");
ServletOutputStream sosStream = response.getOutputStream();
sosStream.write(bridge.getFileBites(uuid)); // calls ContentUtils.convertToByteArray(is)
AlfrescoBridge bridge = new AlfrescoBridge(); // handy class
response.reset();
response.setHeader ("Content-Disposition", "attachment;filename=\""+fileName+"\"");
ServletOutputStream sosStream = response.getOutputStream();
if(fileName.endsWith("docx")) {
sosStream.write(bridge.getFileBites(fileID)); // calls ContentUtils.convertToByteArray(is)
}
else {
InputStream in = bridge.getFileInputStream(fileID); // calls ContentUtils.getContentAsInputStream(contentReadResult[0]);
int ibit = 256;
while ((ibit) >= 0) {
ibit = in.read();
sosStream.write(ibit);
}
sosStream.flush();
in.close();
}
sosStream.close();
08-24-2010 08:15 AM
//After cwd to the correct directory:
ByteArrayOutputStream output = new ByteArrayOutputStream();
ftp.retrieveFile(fileName, output);
return output.toByteArray(); And all is well for all files.Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.