Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2182

Inefficient creation of nodes with large binary content

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Done
    • Icon: Major Major
    • 4.0.0.Alpha2
    • 3.7.1.Final
    • Web Application
    • None

      Current REST API does not allow an efficient creation of nodes with a binary content. To create a nt:file node with a large binary content Modeshape needs a lot of memory, approx. 3 x size of the content - an overhead of Base64 encoding and converting a whole request to a String object (java.lang String uses UTF-16 as an internal representation).

      For my current customer I've created a custom REST handler which uses Jackson's streaming parser, specifically JsonParser#readBinaryValue. If you are interested I could ask about permission to contribute this code to ModeShape project (needs a lot of polishing though). It would be nice to use the current JSON parser (Jettison) but AFAIK it doesn't allow such efficient document processing.

      Note: REST API gives this (https://docs.jboss.org/author/display/MODE/REST+Service+3.x#RESTService3.x-18.Createabinaryproperty%28viarequestcontent%29) but I don't think that you can create nt:file (specifically a nt:resource child) this way due to a mandatory jcr:data property. A possible workaround could be:

      It's pretty convoluted though and the operation isn't atomic anymore.

      I'm aware of https://issues.jboss.org/browse/MODE-1583 - anyway, I don't think it resolves an above case. Did I missed something?

              hchiorean Horia Chiorean (Inactive)
              marcin.galazka Marcin Gałązka (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: