You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Justin Edelson (JIRA)" <ji...@apache.org> on 2017/10/17 14:38:00 UTC

[jira] [Commented] (SLING-7203) Sling Model Request-Scoped Caching Not Effective Across Script Include Boundaries

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

Justin Edelson commented on SLING-7203:
---------------------------------------

Thinking about this some more, unwinding the wrapping would probably break the functionality added in SLING-7015 (as well as custom implementations doing similar things).

> Sling Model Request-Scoped Caching Not Effective Across Script Include Boundaries
> ---------------------------------------------------------------------------------
>
>                 Key: SLING-7203
>                 URL: https://issues.apache.org/jira/browse/SLING-7203
>             Project: Sling
>          Issue Type: Bug
>            Reporter: Justin Edelson
>
> The request-scoped caching added in SLING-6785 does not work correctly across included boundaries, i.e. if you have a script like
> {code}
> <sly data-sly-resource="${'first' @ resourceType='my/resource/type/first'}"/>
> <sly data-sly-resource="${'second' @ resourceType='my/resource/type/second'}"/>
> {code}
> and both {{first.html}} the request is adapted to some cacheable model object, the adaptation will happen twice, despite the cache attribute on the {{@Model}} annotation.
> The reason for this is that each script actually has a unique request object, instantiated by {{ScriptHelper}} (see https://github.com/apache/sling/blob/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/ScriptHelper.java#L100).
> I don't know what a good way to fix this is. One option could be to unwrap the {{SlingHttpServletRequestWrapper}} in {{SlingModelsUseProvider}}.
> [~kwin] any ideas?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)