Hi Team,
Can somebody send me the code or api , if I will pass current page url (which contains alias name) then it will return the exact content path. Means I want read the current page jcr:content properties but its returning null because in currentpage is mixed with sling:alias.
Example:
Without alias: http://localhost:4502/content/aaabbccc/test.html
With alias: http://localhost:4502/content/abc/test.html
My code:
String currentPage=slingHttpServletRequest.getPathInfo();
if (currentPage.contains(".html")) {
currentPage = currentPage.replace(".html", "");
}
Node currentNode = resourceResolver.getResource(currentPage).adaptTo(Node.class);
the above code is returning null because currentPage path is "/content/abc/test" and there is no resource like "/content/abc/test" because of "abc" is alias "/content/aaabbccc/test" .
If I will access " http://localhost:4502/content/aaabbccc/test.html" then result is coming fine.
Regards,
Jaganath