[
https://issues.apache.org/jira/browse/SLING-6036?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Stefan Seifert resolved SLING-6036.
-----------------------------------
Resolution: Fixed
> ResourceBuilder: Reusing ResourceBuilder instances
> --------------------------------------------------
>
> Key: SLING-6036
> URL: https://issues.apache.org/jira/browse/SLING-6036
> Project: Sling
> Issue Type: Improvement
> Components: Extensions
> Reporter: Stefan Seifert
> Assignee: Stefan Seifert
> Priority: Minor
> Fix For: Resource Builder 1.0.0
>
>
> follow-up from discussion in
> [SLING-5356|https://issues.apache.org/jira/browse/SLING-5356?focusedCommentId=15458657#comment-15458657]
> B) reusing resourcebuilder instances
> example 2:
> {noformat}
> resourceBuilder =
> getService(ResourceBuilder.class).forResolver(resourceResolver);
> resourceBuilder.resource("content/page1");
> resourceBuilder.resource("content/page2");
> {noformat}
> 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:
> {noformat}
> resourceBuilder =
> getService(ResourceBuilder.class).forResolver(resourceResolver);
> resourceBuilder.resource("content/page1")
> .atParent()
> resource("content/page2");
> {noformat}
> but if creating bigger content structures it makes sense to not use one
> gigantic fluent line, but split if up in smaller parts.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)