This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/sling-site.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new cfe0bde  Fix Namespace Mangling
cfe0bde is described below

commit cfe0bde1ca4070c16c9742d927f7b6d8fdff78ce
Author: Konrad Windszus <[email protected]>
AuthorDate: Thu Nov 15 12:59:36 2018 +0100

    Fix Namespace Mangling
---
 .../the-sling-engine/mappings-for-resource-resolution.html   | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/documentation/the-sling-engine/mappings-for-resource-resolution.html 
b/documentation/the-sling-engine/mappings-for-resource-resolution.html
index 71598b2..b335668 100644
--- a/documentation/the-sling-engine/mappings-for-resource-resolution.html
+++ b/documentation/the-sling-engine/mappings-for-resource-resolution.html
@@ -126,11 +126,11 @@
 </ul>
 <p>Note, that these node types only help setting the properties. The 
implementation itself only cares for the properties and their values and not 
for any of these node types.</p>
 <h2><a href="#namespace-mangling" name="namespace-mangling">Namespace 
Mangling</a></h2>
-<p>There are systems accessing Sling, which have a hard time handling URLs 
containing colons &ndash; <code>:</code> &ndash; in the path part correctly. 
Since URLs produced and supported by Sling may contain colons because JCR Item 
based resources may be namespaced (e.g. <code>jcr:content</code>), a special 
namespace mangling feature is built into the 
<code>ResourceResolver.resolve</code> and <code>ResourceResolver(map)</code> 
methods.</p>
-<p>Namespace mangling operates such, that any namespace prefix identified in 
resource path to be mapped as an URL in the <code>map</code> methods is 
modified such that the prefix is enclosed in underscores and the colon 
removed.</p>
-<p><em>Example</em>: The path 
<code>/content/*a*sample/jcr:content/jcr:data.png</code> is modified by 
namespace mangling in the <code>map</code> method to get at 
<code>/content/*a*sample/*jcr*content/*jcr*data.png</code>.</p>
-<p>Conversely the <code>resolve</code> methods must undo such namespace 
mangling to get back at the resource path. This is simple done by modifying any 
path such that segments starting with an underscore enclosed prefix are changed 
by removing the underscores and adding a colon after the prefix. There is one 
catch, tough: Due to the way the SlingPostServlets automatically generates 
names, there may be cases where the actual name would be matching this 
mechanism. Therefore only prefixes a [...]
-<p><em>Example</em>: The path 
<code>/content/*a*sample/*jcr*content/*jcr*data.png{*</code>} <em>is modified 
by namespace mangling in the</em> <code>{*}resolve{*</code>} <em>method to 
get</em> <code>*/content/*a*sample/jcr:content/jcr:data.png{*}{</code>}*. The 
prefix* <code>*\*a{*}{</code>}<code>{</code>} is not modified because there is 
no registered namespace with prefix <code>a</code>. On the other hand the 
prefix <code>{*}jcr{*</code>} is modified because there is of course a registe 
[...]
+<p>There are systems accessing Sling, which have a hard time handling URLs 
containing colons (<code>:</code>) in the path part correctly. Since URLs 
produced and supported by Sling may contain colons because JCR item based 
resources may be namespaced (e.g. <code>jcr:content</code>), a special 
namespace mangling feature is built into the 
<code>ResourceResolver.resolve(...)</code> and 
<code>ResourceResolver.map(...)</code> methods.</p>
+<p>Namespace mangling operates such, that any namespace prefix identified in 
resource path to be mapped as an URL in the <code>map</code> methods is 
modified such that the prefix is enclosed in underscores and the colon is 
removed.</p>
+<p><em>Example</em>: The path 
<code>/content/_a_sample/jcr:content/jcr:data.png</code> is modified by 
namespace mangling in the <code>map</code> method to 
<code>/content/_a_sample/_jcr_content/_jcr_data.png</code>.</p>
+<p>Conversely, the <code>resolve</code> methods must undo such namespace 
mangling to get back at the resource path. This is simple done by modifying any 
path such that segments starting with an underscore enclosed prefix are changed 
by removing the underscores and adding a colon after the prefix. There is one 
catch, tough: Due to the way the <code>SlingPostServlet</code> automatically 
generates names, there may be cases where the actual name would be matching 
this mechanism. Therefore on [...]
+<p><em>Example</em>: The path 
<code>/content/_a_sample/_jcr_content/_jcr_data.png</code> is modified by 
namespace mangling in the <code>resolve</code> method to get 
<code>/content/_a_sample/jcr:content/jcr:data.png</code>. The prefix 
<code>_a_</code> is not modified because there is no registered namespace with 
prefix <code>a</code>. On the other hand the prefix <code>jcr</code> is 
modified because there is of course a registered namespace with prefix 
<code>jcr</code>.</p>
 <h2><a href="#root-level-mappings" name="root-level-mappings">Root Level 
Mappings</a></h2>
 <p>Root Level Mappings apply to the request at large including the scheme, 
host, port and uri path. To accomplish this a path is constructed from the 
request lik this <code>{scheme}/{host}.{port}/{uri_path}</code>. This string is 
then matched against mapping entries below <code>/etc/map</code> which are 
structured in the content analogously. The longest matching entry string is 
used and the replacement, that is the redirection property, is applied.</p>
 <h3><a href="#mapping-entry-specification" 
name="mapping-entry-specification">Mapping Entry Specification</a></h3>
@@ -318,7 +318,7 @@ for (String segment: segments) {
 <p>Use the Felix Web Console Plugin provided at 
<code>/system/console/jcrresolver</code> to inspect both the mapping and the 
resolver map entries. Also you can check what either 
<code>ResourceResolver.map(...)</code> or 
<code>ResourceResolver.resolve(...)</code> would return for a given 
URL/path.</p></section></div></div>            
             <div class="footer">
 <div class="revisionInfo">
-                    Last modified by <span class="author">Konrad 
Windszus</span> on <span class="comment">Fri Jul 13 11:08:10 2018 +0200</span>
+                    Last modified by <span class="author">Konrad 
Windszus</span> on <span class="comment">Thu Nov 15 12:57:41 2018 +0100</span>
                 </div>                <p>
                     Apache Sling, Sling, Apache, the Apache feather logo, and 
the Apache Sling project logo are trademarks of The Apache Software Foundation. 
All other marks mentioned may be trademarks or registered trademarks of their 
respective owners.
                 </p><p>

Reply via email to