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 13:57:00 UTC

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

Justin Edelson created SLING-7203:
-------------------------------------

             Summary: 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)