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 2014/10/22 04:27:34 UTC

[jira] [Reopened] (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:all-tabpanel ]

Justin Edelson reopened SLING-4083:
-----------------------------------

[~sseifert@pro-vision.de] I think this warrants some discussion on sling-dev. I have two concerns.

1) This ThreadLocal filter doesn't seem to be appropriate as part of Sling Models. If such a filter is going to be part of Sling it should IMHO be done in the engine and then used across the codebase. Of course, then we need to figure out how to work with old versions of the Engine bundle, but that's a solveable problem.

2) In the past, there have been objections to these types of ThreadLocal filters (see, for example, http://sling.markmail.org/thread/epn5vdw3fkmpsk6w). This isn't to say that we shouldn't have this filter, but I think it is important (and Apache way-ish) to at least try to reconcile this on sling-dev before going to far.

NOTE - I'm *not* asking you to revert your code, just to start a discussion about this change.

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