1 Jan 2010 11:31
Storing and retrieving images from jackrabbit
test123456 <sajith.pc <at> thinkcoretech.com>
2010-01-01 10:31:53 GMT
2010-01-01 10:31:53 GMT
Hi new to jackrabbit.
I try to create a content repository to store the images uploaded by users
from my web application.
I am having the environment
Tomcat 6.0.13 server
JDK 1.6
Jackrabbit 1.6
I am using the following code snippet for that for adding image
Node rootNode = session.getRootNode();
String fileName = "abc.gif";
String destinationNodeName = "attachment";
// First check the type of the file to add
MimeTable mt = MimeTable.getDefaultTable();
String mimeType = mt.getContentTypeFor(fileName);
if (mimeType == null)
{
mimeType = "application/octet-stream";
}
// Get the destinationNode to which the file to be added
Node destinationNode = rootNode.addNode(destinationNodeName);
Node file = destinationNode.addNode(fileName, "nt:file");
Node contentNode = file.addNode("jcr:content", "nt:resource");
(Continue reading)
RSS Feed