[
https://issues.apache.org/jira/browse/SLING-10357?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17340194#comment-17340194
]
Carsten Ziegeler commented on SLING-10357:
------------------------------------------
I'm not sure if we should go this way, it usually creates weak contracts and
you end up with that magic set of objects that are hidden in attributes in the
resource resolver which is required in order to call a method. Being explicit
and passing all the details around is usually creating a clearer contract.
If you want a weak contract, you could use the request object which supports
attributes or a thread local and store a map of objects there and create a
listener that cleans up when the request ends
> As a developer I would like to store extra attribute in the resource resolver
> -----------------------------------------------------------------------------
>
> Key: SLING-10357
> URL: https://issues.apache.org/jira/browse/SLING-10357
> Project: Sling
> Issue Type: Improvement
> Components: ResourceResolver
> Affects Versions: Resource Resolver 1.7.4
> Reporter: Thierry Ygé
> Priority: Major
>
> Sometime we need to cache information which is resource resolver live time
> dependent.
> So far we need then to keep a hashmap somewhere with the "resource resolver"
> object as key , and then we need to cleanup that cache from time to time when
> "resource resolver" object is no longer alive.
> Having a mean to add extra metadata along to the resource resolver object
> would help simplifying such use case of caching.
>
> Currently the ResourceResolver API offer a getAttribute() which is then read
> only as there is no setAttribute currently, maybe we need something like
> get/setMetadata(...) for storing anything along with the resolver.
> cc [~radu] [~bdelacretaz]
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)