I am using AEM 6.1 and am experiencing some weird behaviour with the 'resolve' method of the ResourceResolver.
I have a bunch of mappings that work correctly on the live site, when I use the '.../system/console/jcrresolver' to test my mappings I get the following result:
When I try to use the resolve method from ResourceResolver in code I do get a wrong result:
resourceResolver.resolve("https://acc-company.com/nl/size-guides").getPath();
Results in: '/https://acc-company.com/nl/size-guides', why am I not receiving '/content/www-company-com/nl/size-guides' ?
NOTE: mapping (the reverse of resolving) does work when triggered from code:
resourceResolver.map("/content/www-company-com/nl/size-guides");
Results in: 'https://acc-company.com/nl/size-guides'
Any idea what is causing the resolving to fail?
Thanks in advance
Jeroen
Solved! Go to Solution.
Hi,
sling - CQ5: How to programmatically find out the Resource given a URL? - Stack Overflow
talks about something similar. Can you take a look at it once.
Hi,
Not pretty sure, but just a thought.
After doing Resource resource = resolver.resolve(pagePath), You might want to use adaptTo() like resource.adaptTo(Page.class) and then do a getPath() on it and see if it helps.
Views
Replies
Total Likes
Hey
The result of the resolve is a 'NonExistingResource' so it's pointless to call 'adaptTo' on this because it will result in 'null'
Views
Replies
Total Likes
Hi,
sling - CQ5: How to programmatically find out the Resource given a URL? - Stack Overflow
talks about something similar. Can you take a look at it once.
Views
Likes
Replies