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

ResourceBuilder: Reusing ResourceBuilder instances

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • Resource Builder 1.0.0
    • Extensions
    • None

    Description

      follow-up from discussion in SLING-5356

      B) reusing resourcebuilder instances
      example 2:

      resourceBuilder = getService(ResourceBuilder.class).forResolver(resourceResolver);
      resourceBuilder.resource("content/page1");
      resourceBuilder.resource("content/page2");
      

      this produces not the expected result - it produces
      /content/page1
      /content/page1/content/page2
      instead of
      /content/page1
      /content/page2

      it would be useful if the resourcebuilder returned by a resource method has a new parent set, but not the builder instance initially applyed the resource method on.
      currently the only way to get the expected result is something like:

      example 3:

      resourceBuilder = getService(ResourceBuilder.class).forResolver(resourceResolver);
      resourceBuilder.resource("content/page1")
      .atParent()
      resource("content/page2");
      

      but if creating bigger content structures it makes sense to not use one gigantic fluent line, but split if up in smaller parts.

      Attachments

        Issue Links

          Activity

            People

              sseifert Stefan Seifert
              sseifert Stefan Seifert
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: