hi

Is there a way to obtain file import with the use of webdav interface? By file import I understand something equivalent to the following calls
using jcr api:
public Node importFile (Node folderNode, File file, String mimeType,
            String encoding) throws RepositoryException, IOException
    {
        //create the file node - see section 6.7.22.6 of the spec
        Node fileNode = folderNode.addNode (file.getName (), "nt:file");
//create the mandatory child node - jcr:content
        Node resNode = fileNode.addNode ("jcr:content", "nt:resource");
        resNode.setProperty ("jcr:mimeType", mimeType);
        resNode.setProperty ("jcr:encoding", encoding);
        resNode.setProperty ("jcr:data", new FileInputStream (file));
        Calendar lastModified = Calendar.getInstance ();
        lastModified.setTimeInMillis (file.lastModified ());
        resNode.setProperty ("jcr:lastModified", lastModified);

        return fileNode;
    }

you can achieve that by either

- run an XML import that creates at least all mandatory nodes and
  properties i.e. a MKCOL request with request body.
  see the mentioned docu draft or the spi contrib for an example.

- run separate MKCOL and PUT calls for each of the items.
  however, you need to create the custom LOCK/UNLOCK brackets
  around the call, in order to avoid a premature save call, that
  would fail if mandatory items are still missing.

hope that helps
angela

Reply via email to