Any ideal use-case of injecting servlet in Sling Models ? @Model(adaptables=SlingHttpServletRequest.class)public class MyModel {@Inject@Filter("(paths=/bin/something)")private List<Servlet> servlets;}
Ref. :-https://sling.apache.org/documentation/bundles/models.html
Solved! Go to Solution.
Views
Replies
Total Likes
According to the docs - you can use this annotation to filter OSGi injections "OSGi injection can be filtered"
However - i am not finding use cases or examples with Sling Models that make use of this feature.
Here is another code example of SLing Models (-but it does not use @Filter)
Views
Replies
Total Likes
What's your point?. Why would you use servlet in SlindModel?.
Jitendra
Views
Replies
Total Likes
Yes, reason being calling servlet methods do not makes much sense.
May be I am missing something here in case of servlet.
Injecting any other service seems reasonable though.
Views
Replies
Total Likes
By design, Servlets are not mean to be treated like services. Servlet technology is being used for communication between client & server over the HTTP protocol.
Sunil Chowdhary wrote...
Yes,
reason being calling servlet methodsdo not makes much sense.
May be I am missing something here in case of servlet.
Injecting any other service seems
reasonable though .
Views
Replies
Total Likes
Here is a related article on using Sling Models within AEM:
https://helpx.adobe.com/experience-manager/using/sling_models.html
Views
Replies
Total Likes
Views
Replies
Total Likes
Thanks for your reply.
Went through the mentioned article, but still not able to get the use of below code available at
https://sling.apache.org/documentation/bundles/models.html
@Inject@Filter("(paths=/bin/something)")private List<Servlet> servlets;
Views
Replies
Total Likes
According to the docs - you can use this annotation to filter OSGi injections "OSGi injection can be filtered"
However - i am not finding use cases or examples with Sling Models that make use of this feature.
Here is another code example of SLing Models (-but it does not use @Filter)
Views
Replies
Total Likes