You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Radu Cotescu (JIRA)" <ji...@apache.org> on 2016/07/06 11:10:10 UTC

[jira] [Commented] (SLING-5342) Sightly: Add support for passing resource as argument

    [ https://issues.apache.org/jira/browse/SLING-5342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15364142#comment-15364142 ] 

Radu Cotescu commented on SLING-5342:
-------------------------------------

[~rschaer], can you please provide me with more details? I'd like to see your Sling Model code, as I was not able to reproduce it with the following trivial example:
{code:java}
@Model(adaptables = SlingHttpServletRequest.class)
public class RequestModel {

    @Inject @Named("resource") @Source("request-attributes")
    private Resource suffixResource;

    public Resource getSuffixResource() {
        return suffixResource;
    }
}
{code}
{code:html}
<div data-sly-use.model="${'RequestModel' @ resource=request.requestPathInfo.suffixResource}">
Suffix path: ${model.suffixResource.path}
</div>
{code}

> Sightly: Add support for passing resource as argument
> -----------------------------------------------------
>
>                 Key: SLING-5342
>                 URL: https://issues.apache.org/jira/browse/SLING-5342
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>            Reporter: Roland Schaer
>            Priority: Minor
>              Labels: Sightly
>
> Currently passing {{resource}} as argument via {{data-sly-use}} attribute to a Sling Model does not seem to be supported. While passing an argument with a different name than {{resource}} works, the current implementation does not allow to override the request resource bound to that variable name.
> {code:title=Example}
> data-sly-use="${'my.package.Model' @ resource=request.requestPathInfo.suffixResource}"
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)