Hi Audrey,
It looks ok to me.  Did you call session.save() at the end?

On Jul 29, 2010 10:03 AM, "Audrey Colbrant" <[email protected]>
wrote:

Hi,

I am trying to create a file from server side following some examples, but
no way, the file is not created.
I have had a look to server logs but I don't find any error and the source
code is not throwing anything.

Here the piece of code:
           Node root = session.getRootNode();
           Node userRoute=root.getNode("content/myProjectNode");

           Node fileNode = userRoute.addNode("myFile.gpx", "nt:file");
           Node resNode = fileNode.addNode("jcr:content", "nt:resource");

           resNode.setProperty("jcr:mimeType", "text/xml");
           resNode.setProperty("jcr:encoding", "UTF-8");

 
resNode.setProperty("jcr:lastModified",Calendar.getInstance().getTimeInMillis());
           resNode.setProperty("jcr:data",new
ByteArrayInputStream(myString.getBytes()) );

Does anybody find something wrong?

Thanks in advance,

Audrey

Reply via email to