You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Stefan Seifert (JIRA)" <ji...@apache.org> on 2014/10/21 18:14:33 UTC
[jira] [Commented] (SLING-4083) Sling Models: Enable SlingObject
injector to inject all context objects when a request is attached to the
current thread
[ https://issues.apache.org/jira/browse/SLING-4083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14178574#comment-14178574 ]
Stefan Seifert commented on SLING-4083:
---------------------------------------
Completed: At revision: 1633409
implemented using a servlet filter that attaches the current request to a thread local and cleans up after that.
(i would be nice to have such a feature in a central place e.g. the Sling API - [Interface|https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorRequestContext.java], [Impl|https://svn.apache.org/repos/asf/sling/trunk/bundles/extensions/models/impl/src/main/java/org/apache/sling/models/impl/injectors/SlingObjectInjectorRequestContextFilter.java]).
> Sling Models: Enable SlingObject injector to inject all context objects when a request is attached to the current thread
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: SLING-4083
> URL: https://issues.apache.org/jira/browse/SLING-4083
> Project: Sling
> Issue Type: Improvement
> Components: Extensions
> Affects Versions: Sling Models Implementation 1.1.0
> Reporter: Stefan Seifert
> Assignee: Stefan Seifert
> Labels: models
> Fix For: Sling Models Impl 1.2.0
>
>
> The SlingObjectInjector should support injecting all context objects (Resource, ResourceResolver, Request, Response, SlingScriptHelper) always, and not only when derivable from the current adaptable.
> in sling models 1.1.0 the injection of most of those objects fails e.g. when adapting from a resource resolver because the request object is not available. thus if a developer uses a @SlingObject annotation he has to be aware of those implementation details when the context objects are available and when not. if used from a scripting language light Sightly which first tries to adapt a model from the current resource, and after that from the current request things get worse.
> if a model is adapted in a thread initiated from a request all injections should be always supported.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)