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

Radu Cotescu commented on SLING-4734:
-------------------------------------

We should also optimise the {{ModelFactoryUseProvider}} to fail as early as 
possible, therefore I'd call this line \[0\] immediately the resource and class 
object can be obtained.

\[0\ - 
https://github.com/apache/sling/blob/90d2ed9e42deb144a7f6e1610871e72726cd810a/bundles/scripting/sightly/models-use-provider/src/main/java/org/apache/sling/scripting/sightly/models/impl/ModelFactoryUseProvider.java#L98

> Sightly should try to instantiate Sling Models first via 
> SlingHttpServletRequest then via Resource and not the other way around
> -------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: SLING-4734
>                 URL: https://issues.apache.org/jira/browse/SLING-4734
>             Project: Sling
>          Issue Type: Improvement
>          Components: Scripting
>    Affects Versions: Scripting Sightly Models Use Provider 1.0.0
>            Reporter: Konrad Windszus
>             Fix For: Scripting Sightly Models Use Provider 1.0.0
>
>
> Currently the {{JavaUseProvider}} first tries to instantiate Sling Models via 
> the {{Resource}} then via the {{SlingHttpServletRequest}}. I would argue that 
> the inverse order makes more sense, because more injections are supported via 
> the {{SlingHttpServletRequest}} for Sling Models.
> This would only matter though, where the same class would be adaptable from 
> both {{Resource}} and {{SlingHttpServletRequest}}. In that case though the 
> instantiation via the {{SlingHttpServletRequest}} would support more 
> injections (e.g. the SlingObjectInjector supports much more with the 
> {{SlingHttpServletRequest}}, compare with SLING-4083)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to