I am adding a image to the jackrabbit repository.
I am using jackrabbit 1.6.0 version .
While try to retrieve the image from the repository it is throwing the
PathNotFoundException for jcr:data
It is showing only two properties
jcr:created
jcr:primaryType
there is no jcr:data property.
What will be the problem
I used the following snippet for adding the image to repository
Node folder =
session.getRootNode().addNode("ptattachment");
Node file = folder.addNode(fileName, "nt:file");
MimeTable mt = MimeTable.getDefaultTable();
String mimeType = mt.getContentTypeFor(fileName);
if (mimeType == null) mimeType =
"application/octet-stream";
Node contentNode = file.addNode("jcr:content",
"nt:resource");
contentNode.setProperty("jcr:data", fileStream);
contentNode.setProperty("jcr:lastModified",
Calendar.getInstance());
contentNode.setProperty("jcr:mimeType", mimeType);
session.save();
And used following code to retrieve the image
node = session.getRootNode().getNode("ptattachment");
InputStream in = n.getProperty("jcr:data").getStream();
--
View this message in context:
http://n4.nabble.com/Image-attachment-problem-tp991776p991776.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.