You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@sling.apache.org by Christopher Rockwell <cm...@umich.edu> on 2016/08/09 13:37:48 UTC

Outbound Link Mangling

Hi all. 

I’m having trouble with outbound links within AEM containing colons (:) within the URL hash. The problem seems to stem from Sling URL mangling. I created a Stackoverflow question with the details- see link below. I’m hoping folks on the list can take a look and provide some suggestions.

http://stackoverflow.com/questions/38752586/outbound-links-with-colon-in-hash-get-mangled <http://stackoverflow.com/questions/38752586/outbound-links-with-colon-in-hash-get-mangled>

Thanks! 
Chris Rockwell
University of Michigan 
Web Services, Sr. Application Developer
cmrockwe@umich.edu <ma...@umich.edu>, 



Re: Outbound Link Mangling

Posted by Christopher Rockwell <cm...@umich.edu>.
Thanks very much for taking the time to respond. 

I have tried unchecking the Namespace Mangling option of the Resource Resolver Factory. I have a few observations. Unfortunately it did not fix the problem. Rendering of the link still was still rewritten removing the colon (:) and surrounding with _*_   The only change I noticed was that the authoring interface became usable as many AJAX requests became unresolved. For example, the sidekick no longer had components populated. The network tab in Chrome was full of 404 requests looking like this...http://localhost:4502/etc/designs/my-app/_jcr_content.0.json/ -> 404 . Checking Namespace Mangling again in the Resource Resolver Factory resolved that.

So it seems AEM might require Namespace Mangling to be enabled. Since disabling it did not fix the problem anyway, I will leave it enabled. Based on the description, Namespace Mangling should only affect the URI path, correct? But it apparently also rewrites hash fragments. IMO the description and documentation could be updated to reflect all parts of the URI affected by Namespace Mangling. Since disabling it did not 100% work, I feel there’s probably an issue there. The only apparent change was that incoming requests containing underscores (_jcr_content) were not resolved, however the filter rewriting links continued to mangle the namespaces in both the path and hash fragment.

Fortunately, I have found a workaround for this issue. Since the URI affecting us do not require a path, just deleting the slash works for us.

For example, 
https://emailgroup.signup.com/#group:this-group - > https://emailgroup.signup.com/_#group_this-group (NG)
https://emailgroup.signup.com#group:this-group  (OK)


> On Aug 9, 2016, at 10:00 AM, Steven Walters <ke...@gmail.com> wrote:
> 
> This is the namespace mangling feature in the Sling Resource Resolver
> Factory configuration:
> 
> 
> Namespace Mangling
> 
> Defines whether namespace prefixes of resource names inside the path
> (e.g. "jcr:" in "/home/path/jcr:content") are mangled or not. Mangling
> means that any namespace prefix contained in the path is replaced as
> per the generic substitution pattern "/([^:]+):/_$1_/" when calling
> the "map" method of the resource resolver. Likewise the "resolve"
> methods will unmangle such namespace prefixes according to the
> substituation pattern "/_([^_]+)_/$1:/". This feature is provided
> since there may be systems out there in the wild which cannot cope
> with URLs containing colons, even though they are perfectly valid
> characters in the path part of URI references with a scheme. The
> default value of this property if no configuration is provided is
> "true". (resource.resolver.manglenamespaces)
> 
> 
> As indicated in the description, the option is on by default, so
> turning it off should fix your issue here.
> 
> This is a feature that is meant for JCR namespaces appearing in paths,
> as they are prefixed by colons, such as "jcr:content" getting mangled
> into "_jcr_content" that is often seen in AEM content trees.
> As such, you may need to validate that turning this off isn't going to
> cause other issues in return.
> 
> On Tue, Aug 9, 2016 at 10:37 PM, Christopher Rockwell
> <cm...@umich.edu> wrote:
>> Hi all.
>> 
>> I’m having trouble with outbound links within AEM containing colons (:) within the URL hash. The problem seems to stem from Sling URL mangling. I created a Stackoverflow question with the details- see link below. I’m hoping folks on the list can take a look and provide some suggestions.
>> 
>> http://stackoverflow.com/questions/38752586/outbound-links-with-colon-in-hash-get-mangled <http://stackoverflow.com/questions/38752586/outbound-links-with-colon-in-hash-get-mangled>
>> 
>> Thanks!
>> Chris Rockwell
>> University of Michigan
>> Web Services, Sr. Application Developer
>> cmrockwe@umich.edu <ma...@umich.edu>,
>> 
>> 


Re: Outbound Link Mangling

Posted by Steven Walters <ke...@gmail.com>.
This is the namespace mangling feature in the Sling Resource Resolver
Factory configuration:


Namespace Mangling

Defines whether namespace prefixes of resource names inside the path
(e.g. "jcr:" in "/home/path/jcr:content") are mangled or not. Mangling
means that any namespace prefix contained in the path is replaced as
per the generic substitution pattern "/([^:]+):/_$1_/" when calling
the "map" method of the resource resolver. Likewise the "resolve"
methods will unmangle such namespace prefixes according to the
substituation pattern "/_([^_]+)_/$1:/". This feature is provided
since there may be systems out there in the wild which cannot cope
with URLs containing colons, even though they are perfectly valid
characters in the path part of URI references with a scheme. The
default value of this property if no configuration is provided is
"true". (resource.resolver.manglenamespaces)


As indicated in the description, the option is on by default, so
turning it off should fix your issue here.

This is a feature that is meant for JCR namespaces appearing in paths,
as they are prefixed by colons, such as "jcr:content" getting mangled
into "_jcr_content" that is often seen in AEM content trees.
As such, you may need to validate that turning this off isn't going to
cause other issues in return.

On Tue, Aug 9, 2016 at 10:37 PM, Christopher Rockwell
<cm...@umich.edu> wrote:
> Hi all.
>
> I’m having trouble with outbound links within AEM containing colons (:) within the URL hash. The problem seems to stem from Sling URL mangling. I created a Stackoverflow question with the details- see link below. I’m hoping folks on the list can take a look and provide some suggestions.
>
> http://stackoverflow.com/questions/38752586/outbound-links-with-colon-in-hash-get-mangled <http://stackoverflow.com/questions/38752586/outbound-links-with-colon-in-hash-get-mangled>
>
> Thanks!
> Chris Rockwell
> University of Michigan
> Web Services, Sr. Application Developer
> cmrockwe@umich.edu <ma...@umich.edu>,
>
>