Uploaded image for project: 'Sling'
  1. Sling
  2. SLING-11891

SlingPostServlet: Support importing binary data from json

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Servlets

    Description

      I would like to improve symmetry between export and import in Sling GET/POST servlets.

      So far, JSON Renderer in Sling GET Servlet marked binary properties with an initial colon in their name and dumped the length instead of the data .

      {
        "jcr:primaryType": "nt:resource",
        ":jcr:data": 20127
      }
      

      SlingPostServlet fails to import it since colon is not allowed as a JCR property name which is fine. I'd like to extend the logic, and if a property starts with a colon and it is not LONG then it would mean it carries base64 data:

      {
        "jcr:primaryType": "nt:resource",
        ":jcr:data": "iVBORw0KGgoA...."
      }
      

      JSON importer would make sense of it and convert the base64 into a binary node property.

      The PR is coming.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              yegor.kozlov Yegor Kozlov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: