On 2018-03-16 16:46, William Markmann wrote:
Folders are: *org.apache.jackrabbit.JcrConstants.NT_FOLDER*
Documents are:
Binary fileBinary =
session.getValueFactory().createBinary(new ByteArrayInputStream(data));
Node newFile = parentNode.addNode(filename,
*JcrConstants.NT_FILE*);
newFile.addMixin(*JcrConstants.MIX_VERSIONABLE*);
Node docContents =
newFile.addNode(*JcrConstants.JCR_CONTENT*, *JcrConstants.NT_RESOURCE*);
// docContents.setProperty(JcrConstants.JCR_MIMETYPE,
getMimeType(filename, getFileExtension(filename)));
docContents.setProperty(JcrConstants.JCR_MIMETYPE,
FileUtils.getMimeType(FileUtils.getFileExtension(filename)));
docContents.setProperty(JcrConstants.JCR_ENCODING, "");
docContents.setProperty(JcrConstants.JCR_DATA, fileBinary);
Is there a better choice?
...
I was worried the folder might have "orderable" child nodes, which
creates a significant overhead. But AFAIR that is not the case for
nt:folder (but you may want to check).
Best regards, Julian
PS: I wouldn't set JCR_ENCODING if that information isn't present.