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

Default GET Servlet: Support binary data in JSON Renderer

    XMLWordPrintableJSON

Details

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

    Description

      The JSON Renderer in the Sling GET Servlet does not export binary properties and prints the length instead of the data:

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

      Note that the names of binary properties are prefixed with a colon.

      I would like to introduce an OSGi flag to enable exporting binaries in base64. If enabled, the output would look something like

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

      The default is false which means existing consumers will keep getting the length.

      There is a related ticket https://issues.apache.org/jira/browse/SLING-11891 to make sense of the base64 data when importing from JSON.

      This change will improve symmetry between export and import in Sling GET/POST servlets and make round-trips more reliable.

       

      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: