Could you please please explain about the adaptables in sling models when to go for Resource and when to go for SlingHttpServletRequest what is the use cases
- what will exactly happen when we adapt Resource
what will exactly happen when we adaptSlingHttpServletRequest
Please explain by use case if you have
Solved! Go to Solution.
Please check usage of various annotations which supported only with either Resources or SlingHttpServletRequest
we use resource.class when the class itself is a resource and SlingHttpServletRequest.class is used for getting request objects
Resource is the most commonly used adaptable in Sling Models. It represents a resource in the JCR repository, such as a node or a property. You would typically use Resource as an adaptable if you want to access and manipulate the properties and child nodes of a specific JCR resource.
On the other hand, SlingHttpServletRequest is another adaptable in Sling Models that represents an HTTP request to the Sling framework. You would typically use SlingHttpServletRequest as an adaptable if you want to access the request parameters, headers, and other metadata associated with an HTTP request.