In my Java code via a servlet I am iterating over each component on my page and getting them as sling models. Eg my Image component has a sling model that has the Src, alt text etc. For a page I can then build up a collection of models that represent that page. My issue is when a component has been targeted as I want to output each variation that has been setup. E.g. for Males under 30 a diffrent image has been set in the component. Below the page node in /content/mysite there is only the default setup for the component which sits under a node with the type cq/personalization/components/target
I can see that the other targeted variations sit under /content/campaigns/... but I can't see from my page node how to get all the variants. I have tried to use TargetedContentManager in my sling models and also in my servlet but whenever I include it I get an error. Is this the correct class to use to get the variants/teasers and if so why is it throwing an error (we are using AEM 6.2)
The two ways I have tried to get the TargetContentManager
@OSGiService
private transient TargetedContentManager test;
@Refrence
private transient TargetedContentManager test;
Stacktrace is attached
Views
Replies
Total Likes
I've realised I have been slightly foolish and my bundles hadn't started because of a missing dependencies. However...this in itself is a little confusing. When I include the TargetedContentManager my bundle then begins to complain that the following dependency can not be found:
com.day.cq.personalization,version=[5.8,6) -- Cannot be resolved
However I can see running on AEM 6.2:
AEM Personalization com.day.cq.cqpersonalization version: 5.9.292
I'm guessing that is why the dependency has not been satisfied because while I do have the correct bundle (I think it is...isn't it?) it is a newer version. I haven't changed any of these bundle versions, so why is this case and how can I resolve this
Views
Replies
Total Likes