We are using AEM 6.5.14. The map and reverse map is properly configured. From /system/console/jcrresolver the resolve and map is working fine.
But from code we can not get the full path from domain. In short request.getResourceResolver().resolve("http://local.---world.com").getPath() is not returning the full path.
THE MAP
FROM /system/console/jcrresolver
FROM code map is working
BUT from code resolve is not working
What could be the possible solution?????
Solved! Go to Solution.
Tried too many things, but the resurceReolver.resolve() is not working.
Finally moved to manual solution.
Hi @kaikubad ,
The "resolve" method expects the path of the resource, you have to write something like this:-
resourceResolver.resolve("/content/something")
Also, take a look at the API documentation for more details about these methods.
https://sling.apache.org/apidocs/sling11/org/apache/sling/api/resource/ResourceResolver.html
Hope this helps!
Regards,
Nitesh
I was actually looking for the full path from domain. In this case i dont know the /content/something.
I only have http://local.---world.com/. From this I have to find the actual path mapped with it.
I need this from http://local.---world.com -to> content/---world/global/en.
If you have access to the slingRequest object, then you could use it to get the resource path, something like this:-
request.getRequestPathInfo().getResourcePath()
In this case it will return the servlet path not the content path, because the request is coming on a servlet. And the code snippet you gave returns the current request path info. In my case its a servlet.
I see it's path based servlet, You could try to register your servlet using resourceType
"sling.servlet.resourceTypes="+ "sling/servlet/default",
"sling.servlet.selectors=" + "demo"
So, this way if you call your servlet from a specific page like "<domain>/<something>.demo.html", and then from the servlet, you can invoke
request.getRequestPathInfo().getResourcePath()
You will get the full resource path.
Apart from this AFAIK, there is no other way to internally resolve it from the domain, you could write some logic in your code if you have the mapping details, and append it to resolve to the actual path.
May be you can share your full use case to provide more alternative solutions.
Hope this helps!
Regards,
Nitesh
map is to convert long path to short path.
i.e : contentPath=/content/---world/global/en.
now if i use resourceResolver.map(contentPath) then it will retuen http://local.---world.com/en.
I need the reverse one. I need this from http://local.---world.com -to> content/---world/global.
Can u try this
${request.requestURL.toString}
No its not the case and it doesnt work.
Thanks,The documentation is very good.
But unfortunately this doesn't work.
Tried too many things, but the resurceReolver.resolve() is not working.
Finally moved to manual solution.
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies