On 12.02.2013, at 16:40, katsu <[email protected]> wrote: > I have the following problem. I am accessing jackrabbit repository via > Webdav. Now I would like to add a file node which the content (data) should > point to a locally saved file path/URL. E.g. > > Node fileNode = parentnode.addNode(abc.jpg, "nt:file"); > Node resNode = fileNode.addNode("jcr:content", "nt:resource"); > resNode.setProperty("jcr:mimeType", mimeType); > resNode.setProperty("jcr:encoding", ""); > resNode.setProperty("jcr:data", reference to a URL/File Path); > > And that when I access via Webdav and click on “abc.jpg” I will be > redirected to the actual path of abc.jpg (e.g. http://image.com/abc.jpg).
You might be able to write a custom IOHandler [0]. See also [1]. Note that you don't want to put a string in jcr:data of a nt:resource, as it's defined to be binary. I suggest to use a custom node type my:linkedResource (instead of nt:resource) or even my:linkedFile (instead of nt:file) and use a property like "url" inside jcr:content. [0] http://jackrabbit.apache.org/api/2.0/org/apache/jackrabbit/server/io/IOHandler.html [1] http://markmail.org/message/rg4im42n3h53lt7i [2] http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#3.7.11.5%20nt:resource Cheers, Alex
