Reverse Resolving mapped path

Avatar

Avatar

Abhinav_m

Avatar

Abhinav_m

Abhinav_m

09-03-2016


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)

Replies

Avatar

Avatar

Sham_HC

Total Posts

2.1K

Likes

156

Correct Reply

1.2K

Avatar

Sham_HC

Total Posts

2.1K

Likes

156

Correct Reply

1.2K
Sham_HC

09-03-2016

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

Avatar

Abhinav_m

Avatar

Abhinav_m

Abhinav_m

09-03-2016

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.