You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by wdlcs <wi...@gmail.com> on 2007/12/10 20:50:48 UTC

download binary content

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.
-- 
View this message in context: http://www.nabble.com/download-binary-content-tp14260127p14260127.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: download binary content

Posted by wdlcs <wi...@gmail.com>.
Thank you very much Fabián...

Fabián Mandelbaum wrote:
> 
> I've answered another post that is related to this one I think.
> 
> For "download URL" I understand something like:
> 
> /full/path/to/jcr/node/having/the/bin/content/property/jcr:content/jcr:data
> 
> which may not work at all, because I think that the (only) way to get
> content out of the repo is with the small code excerpt I've wrote on the
> answer I've mentionned at the beginning, something like:
> 
> 1) get the node having the content
> 2) get the content resource property
> 3) get the resource stream and copy the (input) stream to an output stream
> 4) done.
> 
> I hope this answers your question.
> 
> wdlcs escribió:
>> Hi Michael...what I mean is that having a jcr:content node with a
>> jcr:data
>> property (binary content in this property: images,zip files,etc) in the
>> content respository , how could I get the download URL for this binary
>> content through JCR/Jackrabbit?
>>
>> Thanks in advance.
>>
>>
>>
>>
>> Michael Wechner wrote:
>>   
>>> wdlcs wrote:
>>>
>>>     
>>>> Hi all, I would like to know it's possible to get the download URL of a
>>>> binary content in the content repository, 
>>>>
>>>>       
>>> you mean adding images, zip files, etc to the repository through 
>>> JCR/Jackrabbit?
>>>
>>>
>>> Cheers
>>>
>>> Michael
>>>
>>>     
>>>> (My repository content is a
>>>> PostgreSQL database).
>>>>  
>>>>
>>>>       
>>>     
>>>> Thanks in advance.
>>>>  
>>>>
>>>>       
>>> -- 
>>> Michael Wechner
>>> Wyona      -   Open Source Content Management - Yanel, Yulup
>>> http://www.wyona.com
>>> michael.wechner@wyona.com, michi@apache.org
>>> +41 44 272 91 61
>>>
>>>
>>>
>>>     
>>
>>   
> 
> 
> 

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


Re: download binary content

Posted by Fabián Mandelbaum <fm...@gmail.com>.
I've answered another post that is related to this one I think.

For "download URL" I understand something like:

/full/path/to/jcr/node/having/the/bin/content/property/jcr:content/jcr:data

which may not work at all, because I think that the (only) way to get
content out of the repo is with the small code excerpt I've wrote on the
answer I've mentionned at the beginning, something like:

1) get the node having the content
2) get the content resource property
3) get the resource stream and copy the (input) stream to an output stream
4) done.

I hope this answers your question.

wdlcs escribió:
> Hi Michael...what I mean is that having a jcr:content node with a jcr:data
> property (binary content in this property: images,zip files,etc) in the
> content respository , how could I get the download URL for this binary
> content through JCR/Jackrabbit?
>
> Thanks in advance.
>
>
>
>
> Michael Wechner wrote:
>   
>> wdlcs wrote:
>>
>>     
>>> Hi all, I would like to know it's possible to get the download URL of a
>>> binary content in the content repository, 
>>>
>>>       
>> you mean adding images, zip files, etc to the repository through 
>> JCR/Jackrabbit?
>>
>>
>> Cheers
>>
>> Michael
>>
>>     
>>> (My repository content is a
>>> PostgreSQL database).
>>>  
>>>
>>>       
>>     
>>> Thanks in advance.
>>>  
>>>
>>>       
>> -- 
>> Michael Wechner
>> Wyona      -   Open Source Content Management - Yanel, Yulup
>> http://www.wyona.com
>> michael.wechner@wyona.com, michi@apache.org
>> +41 44 272 91 61
>>
>>
>>
>>     
>
>   


Re: download binary content

Posted by wdlcs <wi...@gmail.com>.
Hi Michael...what I mean is that having a jcr:content node with a jcr:data
property (binary content in this property: images,zip files,etc) in the
content respository , how could I get the download URL for this binary
content through JCR/Jackrabbit?

Thanks in advance.




Michael Wechner wrote:
> 
> wdlcs wrote:
> 
>>Hi all, I would like to know it's possible to get the download URL of a
>>binary content in the content repository, 
>>
> 
> you mean adding images, zip files, etc to the repository through 
> JCR/Jackrabbit?
> 
> 
> Cheers
> 
> Michael
> 
>>(My repository content is a
>>PostgreSQL database).
>>  
>>
> 
> 
>>Thanks in advance.
>>  
>>
> 
> 
> -- 
> Michael Wechner
> Wyona      -   Open Source Content Management - Yanel, Yulup
> http://www.wyona.com
> michael.wechner@wyona.com, michi@apache.org
> +41 44 272 91 61
> 
> 
> 

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


Re: download binary content

Posted by Michael Wechner <mi...@wyona.com>.
wdlcs wrote:

>Hi all, I would like to know it's possible to get the download URL of a
>binary content in the content repository, 
>

you mean adding images, zip files, etc to the repository through 
JCR/Jackrabbit?


Cheers

Michael

>(My repository content is a
>PostgreSQL database).
>  
>


>Thanks in advance.
>  
>


-- 
Michael Wechner
Wyona      -   Open Source Content Management - Yanel, Yulup
http://www.wyona.com
michael.wechner@wyona.com, michi@apache.org
+41 44 272 91 61


Re: download binary content

Posted by Alex Lukin <lu...@stu.cn.ua>.
Wednesday 19 December 2007 23:38:08 wdlcs написав:
> Hi Alex...could you explain me how to enabled SimpleWebDav servlet from
> Jackrabbit?.I'm kind of lost in that part.
> Regards.
>
Well, it depends of your deployment model. See 
http://jackrabbit.apache.org/doc/deploy.html

The simpliest way is: use "war" distribution of jackrabbit which is Model 1 
and extend it for your application. WebDav servlets are endabled by default 
in this bundle.

I use model 2 and I slightly modifed both WebDav servlets to access defined 
jackrabbit as server-wide resource. Source code of servlets is included in 
war distribution. I found references to RepositoryAccessServlet in code and 
replaced with my own. If someone needs such solution I may publish it on my 
website.

-- 
SY, Alex Lukin
RIPE NIC HDL: LEXA1-RIPE

Re: download binary content

Posted by wdlcs <wi...@gmail.com>.
Hi Alex...could you explain me how to enabled SimpleWebDav servlet from
Jackrabbit?.I'm kind of lost in that part.
Regards.

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-tp14260127p14425972.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Re: download binary content

Posted by wdlcs <wi...@gmail.com>.
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.


Re: download binary content

Posted by Alex Lukin <lu...@stu.cn.ua>.
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