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

Make exporter servlet script-bindings aware

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • Sling Models Impl 1.3.4
    • Sling Models Impl 1.3.6
    • Extensions
    • None

    Description

      The current exporter servlet [0] doesn't expose scripting variables.

      If a field for the related Sling Model should be injected via the ScriptVariable annotation [1] and the field is not optional, the model can't be initialized and the request to exporter servlet fails.

      Example:

      @Model(adaptables = SlingHttpServletRequest.class, adapters = TestModel.class, resourceType = "core/components/test")
      @Exporter(name = "jackson", extensions = "json")
      public class TestModel {
      
          @ScriptVariable
          private Page currentPage;
      
          public String getName() {
              return currentPage.getName();
          }
      }
      

      [0] https://github.com/apache/sling/blob/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/ExportServlet.java
      [1] https://github.com/apache/sling/blob/trunk/bundles/extensions/models/api/src/main/java/org/apache/sling/models/annotations/injectorspecific/ScriptVariable.java

      Attachments

        Issue Links

          Activity

            People

              justinedelson Justin Edelson
              bupauli Burkhard Pauli
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: