Hi,
Under urls mapping in resource resolver factory, I am trying to put a rule with complete domain name e.g. /content/abc/us/en\.html < https://abc.com/ but this rule is getting skipped and have no effect. On further analysis, it seems colon (:) after the https is the culprit. If I remove it from the rule then this rule works as expected. I tried to escape colon by putting single backslash (e.g. \:) as well as double backslash (\\:) but no luck. Does anyone know how to escape such characters in the resource resolver factory?
thanks
Neeraj
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @nbhart
I decompiled the org.apache.sling.resourceresolver.impl.ResourceResolverFactoryActivator class which is providing the configuration for resource resolver mapping. I have found that when it reads the list of mapping provided by us, it divides the mapping into 3 parts with help of regex that prepart, operator and postpart.
The regex internally used is "(.+)([:<>])(.+)"
which means when you are providing your mapping which is /content/abc/us/en\.html < https://abc.com/
It finds out the parts as Prepart as "/content/abc/us/en.html<https", operator as ":" and postpart as "//abc.com/".
In short, you can not specify your mapping as it will always interpret it wrong due to regex.
There is no way to specify your mapping atleast from Resource resolver configuration.
Thanks,
Nupur
Hello @nbhart -
It seems the encoded colon is not recognized by the browser. When I put the generated url in browser, I got the below error
This site can’t be reached
Check if there is a typo in httpsu003a.
Hi,
To escape special characters like colon (:) in the URL mapping rule of the resource resolver factory, you can use the backslash () followed by the colon. However, in some cases, additional escaping might be required.
Here's an example of how you can escape the colon in the rule:
/content/abc/us/en\.html\:
If this doesn't work, you can try using double backslashes (\) to escape the colon:
/content/abc/us/en\\.html\\:
Hi @nbhart
I decompiled the org.apache.sling.resourceresolver.impl.ResourceResolverFactoryActivator class which is providing the configuration for resource resolver mapping. I have found that when it reads the list of mapping provided by us, it divides the mapping into 3 parts with help of regex that prepart, operator and postpart.
The regex internally used is "(.+)([:<>])(.+)"
which means when you are providing your mapping which is /content/abc/us/en\.html < https://abc.com/
It finds out the parts as Prepart as "/content/abc/us/en.html<https", operator as ":" and postpart as "//abc.com/".
In short, you can not specify your mapping as it will always interpret it wrong due to regex.
There is no way to specify your mapping atleast from Resource resolver configuration.
Thanks,
Nupur
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies