You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Lance <la...@urbandiversion.com> on 2012/01/30 06:20:31 UTC

Re: Storing and retrieving images from jackrabbit

So, they are both slightly wrong...


Solution:
Node fileNode = sourceNode.getNode(<FileName>);
Node contentNode = fileNode.getNode("jcf:content");
InputStream filestream = contentNode.getProperty("jcr:data").getStream();

**the middle node (content) was missing from the output that was in his scheme**

Lance

p.s. for you absolute beginners like me... 
here is how you output if it is an image...


response.setHeader("Content-Disposition", "inline;filename=\"" + 
            "photo.jpg" + "\"");
OutputStream out = response.getOutputStream();
response.setContentType("image/jpeg");
IOUtils.copy(ScapeImagesGenerationService.getImageStream(
        imageId.toString(), repository), out);
out.flush();