jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wdlcs <willy.delacruzsie...@gmail.com>
Subject Re: download binary content
Date Tue, 11 Dec 2007 19:12:02 GMT

Thank you very much Alex...

Alex Lukin wrote:
> 
> Hi!
> Monday 10 December 2007 21:50:48 wdlcs написав:
>> Hi all, I would like to know it's possible to get the download URL of a
>> binary content in the content repository, (My repository content is a
>> PostgreSQL database).
>> Thanks in advance.
> 
> First, you must create right node for binary content. It's hard to find in
> the 
> docs so there's code:
> 
>       //pn is parent node you already created
>       Node fn = pn.addNode("MyFile.jpg", "nt:file");
>       fn.addMixin("mix:referenceable"); //we need UUID of this attachment 
>       Node resource = fn.addNode("jcr:content","nt:resource");
>       resource.setProperty("jcr:mimeType", "file/jpeg");
>       //get binary data from some file on local fs 
>       resource.setProperty("jcr:data", new FileInputStream(f));
>       Calendar lastModified = Calendar.getInstance ();
>       lastModified.setTimeInMillis (f.lastModified ());
>       resource.setProperty("jcr:lastModified", lastModified);
> 
> After that you can acces this node by any browser or webdav client using
> URL 
> like:  http://myhost/myapp/repository/default/PathToMyFiles/MyFile.jpg 
> SimpleWebDav servlet from jackrabbit distro must be enabled ofcourse.
> -- 
> SY, Alex Lukin
> RIPE NIC HDL: LEXA1-RIPE
> 
> 

-- 
View this message in context: http://www.nabble.com/download-binary-content-tp14260127p14280943.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message