Thank you very much Mat. I got my mistake. Your code snippet explains the problem. And it was worked fine also.
On Fri, Jan 1, 2010 at 7:30 PM, Mat Lowery-2 [via Jackrabbit] < [email protected]<ml-node%[email protected]> > wrote: > The storing looks fine but the retrieval looks wrong. Try this: > > Node resourceNode = > session.getRootNode().getNode("ptattachment").getNode(fileName).getNode("jcr:content"); > > InputStream in = resourceNode.getProperty("jcr:data").getStream(); > > On Fri, 2010-01-01 at 04:01 -0800, test123456 wrote: > > > 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 message @ > http://n4.nabble.com/Image-attachment-problem-tp991776p991794.html > To unsubscribe from Image attachment problem, click here< (link removed) =>. > > > -- View this message in context: http://n4.nabble.com/Image-attachment-problem-tp991776p998058.html Sent from the Jackrabbit - Users mailing list archive at Nabble.com.
