jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nayak Vishal" <Vish...@nsb.no>
Subject SV: Jackrabbit examples for File Upload and download
Date Wed, 15 Oct 2008 12:42:58 GMT

thanks Alexander. 

Regards
Vishal Nayak 



-----Opprinnelig melding-----
Fra: Alexander Klimetschek [mailto:aklimets@day.com] 
Sendt: 15. oktober 2008 14:15
Til: users@jackrabbit.apache.org
Emne: Re: Jackrabbit examples for File Upload and download

Because I already mentioned Sling (which simplifies a lot when
developing web applications on top of JCR), here is a blog entry about
how to do custom file uploading in Sling (it works out of the box with
standard html form posting, but often you might want to add metadata
based on the file content):

http://dev.day.com/microsling/content/blogs/main/fileuploadsinsling.html

Regards,
Alex

On Wed, Oct 15, 2008 at 12:38 AM, Alexander Klimetschek
<aklimets@day.com> wrote:
> Hi,
>
> here is some code snippet, completely plain JCR API, leaving out the 
> servlet request file uploading part, since this is not part of 
> Jackrabbit but of your preferred web application framework (you might 
> want to take a look at Apache Sling [1]). I suggest to read the JCR 
> spec [2], which is the one-and-only documentation on JCR (and its well

> readable for a standard).
>
> ------
>
> InputStream fileStream = ... // get the stream from your web app 
> framework String fileName = ... // get a filename from the request or 
> generate it
>
> Node folder = session.getRootNode().getNode("path/to/file/uploads");
> Node file = folder.addNode(fileName, "nt:file"); Node fileContent = 
> file.getNode("jcr:content"); fileContent.setProperty("jcr:data", 
> fileStream); session.save();
>
> ------
>
> [1] http://incubator.apache.org/sling/
> [2] http://jcp.org/en/jsr/detail?id=170
>
> Regards,
> Alex
>
> On Tue, Oct 14, 2008 at 3:24 PM, Nayak Vishal <VishalN@nsb.no> wrote:
>>
>> Hello guys,
>>
>> Does anyone of you have Jackrabbit sample code or examples for File 
>> Upload and file download.
>>
>> Regards
>> Vishal Nayak
>>
>
>
>
> --
> Alexander Klimetschek
> alexander.klimetschek@day.com
>



--
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message