One reason for my other question is the following use case: I want to create a TextImageModel which uses my ImageModel as an injected property and extends my TextModel:
@Model(adaptables = {SlingHttpServletRequest.class})
public class TextImageModel extends TextModel {
@Inject
private ImageModel image;
}
But this doesn't work. It should work when I would be using Resource
as the adaptable, but I need the SlingHttpServletRequest in my ImageModel and TextModel as well:
@Model(adaptables = {SlingHttpServletRequest.class})
public class ImageModel {
@SlingObject
private SlingHttpServletRequest request;
@SlingObject
private Resource resource;
}
How can I inject the ImageModel using the request as adaptable?
The image resource is a child resource with the name image