sling model choice

Avatar

Avatar

kusumam24182037

Avatar

kusumam24182037

kusumam24182037

27-08-2019

Hi,

I have created sling model for the component.

While creating the sling model i need to specify the

@Model(adaptables = Resource.class) or @Model(adaptables=slinghttpservletrequest)

On what bases we have to select the adaptables.

I am new to AEM Kindly explain in detail to understand the concept.

Regards

Kusuma M

View Entire Topic

Avatar

Avatar

rampai

Avatar

rampai

rampai

27-08-2019

Hi kusumam24182037​,

The above links should clear your understanding.

Adapting to a SlingHttpServletRequest gives you more options to manipulate resources in general.

Moreover you can even access request params if you do so.

Adapting to a resource can be done when you just need resource properties and there is not much to do with the request.

Please check if my answer here helps.

Regards,

Ram