Hi all,
This is the page url in my local.
/content/share/coke/en/light/report-template/file_report_template is page path. How can I get this page path using java?
Thank you.
Solved! Go to Solution.
Views
Replies
Total Likes
if you are in sling model you can get path using below code
PageManager pageManager= resource.getResourceResolver().adaptTo(PageManager.class);
Page currentPage = pageManager.getContainingPage(resource);
Thanks,
Mahesh
If you are using sling models, then using the resource you can get the path of a specific node.
you can use resource.getPath();
If you have a page URL then you can use it like this -
URL url1=new URL("http://localhost:4502/content/share/coke/en/light/report-template/file_report_template.html?wcmmode=...");
url1.getPath();
@Prince_Shivhare I'm getting url in string format like this.
String requestRefererPath = request.getHeader(HttpHeaders.REFERER);
How can I get path from this?
Views
Replies
Total Likes
if you are in sling model you can get path using below code
PageManager pageManager= resource.getResourceResolver().adaptTo(PageManager.class);
Page currentPage = pageManager.getContainingPage(resource);
Thanks,
Mahesh
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies