jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Cronen <Christian.Cro...@maxence.de>
Subject How do i get a stored file back from the repository?
Date Tue, 11 Dec 2007 14:09:09 GMT
hey there, 
i have saved a simple file called example.txt in my repository with the 
following code lines. 
                                root = instance.session.getRootNode();
                                Node hello = root.addNode("hello");
                                Node world = hello.addNode("world");
                                world.setProperty("message", "Hello, 
world!");
                                Node test = world.addNode("test", 
"nt:file");
                                Node res = test.addNode("jcr:content", 
"nt:resource");
 
                                File testfile = new 
File("D:/example.txt");
 
                                world.setProperty("filename", 
testfile.getName() );
                                world.setProperty("size", 
testfile.length() );
                                FileInputStream in = new 
FileInputStream(testfile);
                                res.setProperty("jcr:encoding", "");
                                res.setProperty("jcr:mimeType", 
"text/plain");
                                res.setProperty("jcr:data", in );
 
                                Calendar lastModified = 
Calendar.getInstance();
                                lastModified.setTimeInMillis( 
testfile.lastModified() );
 
                                res.setProperty("jcr:lastModified", 
lastModified);
 
                                instance.session.save();
But now i could not get the file back from the repository. So my question 
is what i have to do to get it back. 

Kind regards
Christian


Christian Cronen
Diplom-Student 

maxence solutions gmbh 
phone
fax
cell
internet
skype 
+49-(0)-2133-2599-0
+49-(0)-2133-2599-29
+49-(0)-160-90532507
christian.cronen@maxence.de
christian.cronen



Am Weissen Stein 1
Stuerzelbergcenter
D - 41541 Dormagen
Sitz der Gesellschaft: Dormagen
Handelsregister: HRB 12561, Neuss
Geschäftsführer: Dipl.-Math. Ralf Granderath 
www.maxence.de


Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message