Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session

Reverse Resolving mapped path

Avatar

Level 2


So I am using etc map to shorten URL's and can get the short URL for a given path by -

shortURLPath=resourceResolver.map(pageUrlPath);

Now that I want to get the original URL back, I tried - 

resourceResolver.resolve(shortUrlPath);

But this returns "NonExistingResource". I recall doing this on versions prior to 6.0 and used to work. But now it doesnt. Any idea, on how to reverse resolve a mapped path. (AEM 6.1)

2 Replies

Avatar

Level 10

Always use ResourceResolver.getResource and avoid ResourceResolver.resolve as it is very expensive.  If you have valid use case for ResourceResolver.resolve then it should consider full mapping logic. Please validate the same at [1]. If it is happing at [1] file a support case with logs & output of /system/console/bundles/.json

[1]    http://localhost:4502/system/console/jcrresolver

Avatar

Level 2

Still no luck with get resource as well.

String shortURL =resourceResolver.map("/content/myapp/en_us/home");
Resource res = resourceResolver.getResource(shortURL);

resource object is still null.