You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bu...@apache.org on 2016/09/22 11:59:41 UTC

svn commit: r997990 - in /websites/staging/sling/trunk/content: ./ documentation/the-sling-engine/url-decomposition.html documentation/the-sling-engine/url-to-script-resolution.html

Author: buildbot
Date: Thu Sep 22 11:59:41 2016
New Revision: 997990

Log:
Staging update by buildbot for sling

Modified:
    websites/staging/sling/trunk/content/   (props changed)
    websites/staging/sling/trunk/content/documentation/the-sling-engine/url-decomposition.html
    websites/staging/sling/trunk/content/documentation/the-sling-engine/url-to-script-resolution.html

Propchange: websites/staging/sling/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Thu Sep 22 11:59:41 2016
@@ -1 +1 @@
-1761464
+1761914

Modified: websites/staging/sling/trunk/content/documentation/the-sling-engine/url-decomposition.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/the-sling-engine/url-decomposition.html (original)
+++ websites/staging/sling/trunk/content/documentation/the-sling-engine/url-decomposition.html Thu Sep 22 11:59:41 2016
@@ -114,15 +114,24 @@ h2:hover > .headerlink, h3:hover > .head
   visibility: hidden;
 }
 h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
-<p>During the <em>Resource Resolution</em> step, the client request URL is decomposed into the following parts:</p>
+<div class="toc">
+<ul>
+<li><a href="#examples">Examples</a></li>
+<li><a href="#automated-tests">Automated Tests</a></li>
+</ul>
+</div>
+<p>During the <em>Resource Resolution</em> step, the client request URI (as being returned by <a href="http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#getRequestURI()">HttpServletRequest.getRequestURI()</a>` is decomposed into the following parts (in exactly this order):</p>
 <ol>
-<li><strong>Resource Path</strong> -  The longest substring of the request URL such that the resource path is either the complete request URL or the next character in the request URL after the resource path is a dot (<code>.</code>).</li>
+<li><strong>Resource Path</strong> - For existing resources the resource path is the longest match (also considering its <a href="/documentation/the-sling-engine/mappings-for-resource-resolution.html">mappings</a>) pointing to a resource where the next character is either a dot (<code>.</code>) or it is the full request URI.
+Otherwise (for a path not matching any existing resource) the resource path ends at the <em>first dot (<code>.</code>)</em> in the request url. The exact logic for retrieving the resource path is implemented at <a href="https://sling.apache.org/apidocs/sling7/org/apache/sling/api/resource/ResourceResolver.html#resolve-javax.servlet.http.HttpServletRequest-java.lang.String-">ResourceResolver.resolve(HttpServletRequest,String</a>. <em>It is impossible to tell from just looking at the request URI where the resource path part ends. You have to know the underlying resource structure to know how a URL is decomposed</em>.</li>
 <li><strong>Selectors</strong> -  If the first character in the request URL after the resource path is a dot, the string after the dot up to but not including the last dot before the next slash character or the end of the request URL. If the resource path spans the complete request URL no seletors exist. If only one dot follows the resource path before the end of the request URL or the next slash, also no selectors exist.</li>
 <li><strong>Extension</strong> -  The string after the last dot after the resource path in the request URL but before the end of the request URL or the next slash after the resource path in the request URL. </li>
-<li><strong>Suffix Path</strong> -  If the request URL contains a slash character after the resource path and optional selectors and extension, the path starting with the slash up to the end of the request URL is the suffix path. Otherwise, the suffix path is empty. Note, that after the resource path at least a dot must be in the URL to let Sling detect the resource path.</li>
+<li><strong>Suffix</strong> -  If the request URL contains a slash character after the resource path and optional selectors and extension, the path starting with the slash up to the end of the request URL is the suffix path. Otherwise, the suffix path is empty. Note, that after the resource path at least a dot must be in the URL to let Sling detect the suffix.</li>
 </ol>
-<p>There's a cheat sheet on Day's dev page under <a href="http://dev.day.com/content/docs/en/cq/current/developing/sling_cheatsheet.html">http://dev.day.com/content/docs/en/cq/current/developing/sling_cheatsheet.html</a> available to get you familiar with the URL decomposition of Sling.</p>
-<p><em>Examples</em>: Assume there is a Resource at <code>/a/b</code>, which has no children.</p>
+<p>Those decomposed parts can be accessed through the <code>RequestPathInfo</code> object, which is retrieved via <a href="https://sling.apache.org/apidocs/sling7/org/apache/sling/api/SlingHttpServletRequest.html#getRequestPathInfo--">SlingHttpServletRequest.getPathInfo()</a></p>
+<p>There's a cheat sheet in Adobe's AEM documentation at <a href="https://docs.adobe.com/docs/en/aem/6-2/develop/platform/sling-cheatsheet.html">https://docs.adobe.com/docs/en/aem/6-2/develop/platform/sling-cheatsheet.html</a> available to get you familiar with the URL decomposition of Sling.</p>
+<h1 id="examples">Examples<a class="headerlink" href="#examples" title="Permanent link">&para;</a></h1>
+<p>Assume there is a Resource at <code>/a/b</code>, which has no children.</p>
 <table class="table">
 <thead>
 <tr>
@@ -176,6 +185,14 @@ h2:hover > .headerlink, h3:hover > .head
 <td>no!</td>
 </tr>
 <tr>
+<td>/a/c.html/s.txt</td>
+<td>/a/c</td>
+<td>null</td>
+<td>html</td>
+<td>/s.txt</td>
+<td>no!</td>
+</tr>
+<tr>
 <td>/a/b./c/d</td>
 <td>/a/b</td>
 <td>null</td>
@@ -241,12 +258,13 @@ h2:hover > .headerlink, h3:hover > .head
 </tr>
 </tbody>
 </table>
-<div class="info">
-<b>Automated tests and examples</b><br/>
-The <a href="http://svn.apache.org/repos/asf/sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/impl/request/SlingRequestPathInfoTest.java">SlingRequestPathInfoTest</a> demonstrates and tests this decomposition. Feel free to suggest additional tests that help clarify how this works!
-</div>
+<h1 id="automated-tests">Automated Tests<a class="headerlink" href="#automated-tests" title="Permanent link">&para;</a></h1>
+<p>The tests at
+<em> <a href="http://svn.apache.org/repos/asf/sling/trunk/bundles/resourceresolver/src/test/java/org/apache/sling/resourceresolver/impl/ResourceResolverImplTest.java">ResourceResolverImplTest</a> for the split between resource path and the rest. Mostly in the method <code>testbasicAPIAssumptions</code>.
+</em> <a href="http://svn.apache.org/repos/asf/sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/impl/request/SlingRequestPathInfoTest.java">SlingRequestPathInfoTest</a> demonstrates the decomposition after the resource path part.</p>
+<p>Feel free to suggest additional tests that help clarify how this works!</p>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1500501 by fmeschbe on Sun, 7 Jul 2013 18:49:51 +0000
+        Rev. 1761914 by kwin on Thu, 22 Sep 2016 11:59:23 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project

Modified: websites/staging/sling/trunk/content/documentation/the-sling-engine/url-to-script-resolution.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/the-sling-engine/url-to-script-resolution.html (original)
+++ websites/staging/sling/trunk/content/documentation/the-sling-engine/url-to-script-resolution.html Thu Sep 22 11:59:41 2016
@@ -127,14 +127,13 @@ h2:hover > .headerlink, h3:hover > .head
 </div>
 <p>This page explains how Sling maps URLs to a script or and servlet. </p>
 <p>See also <a href="/documentation/the-sling-engine/servlets.html">Servlets and Scripts</a> which provides detailed info about how to register servlets.</p>
-<p>First of all Sling looks up the resource identified 
-by the URL - typically a path inside the JCR repository, which is annotated by the <code>sling:resourceType</code> property 
+<p>First of all Sling looks up the resource identified by the URL - typically a path inside the JCR repository, which is annotated by the <code>sling:resourceType</code> property 
 which defines the resource type of that resource. Using this resource type (which is kind of a relative path, 
-eg. "myblog/comment"), scripts or servlets are looked up. </p>
-<p>Scripts and servlets are itself resource in Sling and thus have a resource path: this is either the location in the 
+eg. "myblog/comment"), scripts or servlets are looked up. For more details about how the initial resource is identified for a specific request URL look at [URL decomposition] (/documentation/the-sling-engine/url-decomposition.html).</p>
+<p>Scripts and servlets are itself resources in Sling and thus have a resource path: this is either the location in the 
 JCR repository, the resource type in a servlet component configuration or the "virtual" bundle resource path 
 (if a script is provided inside a bundle without being installed into the JCR repository). </p>
-<p>For the Whole Truth about script resolution, see the <a href="http://svn.apache.org/repos/asf/sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java">ScriptSelectionTest</a> class. If you see interesting cases that are not
+<p>For the whole Truth about script resolution, see the <a href="http://svn.apache.org/repos/asf/sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java">ScriptSelectionTest</a> class. If you see interesting cases that are not
 covered there, please let us know via the Sling users mailing list.</p>
 <p>TODO: explain super types, servlet path mappings, node type resource types (<code>my:type -&gt; my/type</code>) </p>
 <h2 id="fundamental-scripts-and-servlets-are-equal">Fundamental: Scripts and Servlets are equal<a class="headerlink" href="#fundamental-scripts-and-servlets-are-equal" title="Permanent link">&para;</a></h2>
@@ -208,7 +207,7 @@ covered there, please let us know via th
 </ul>
 <p>The priority of script selection would be (starting with the best one): (6) - (4) - (5) - (3) - (2) - (1) - (0). Note that (4) is a better match than (5) because it matches more selectors even though (5) has an extension match where (4) does not. (7) is not a candidate because it does not include the first selector (print) and (8) is not a candidate because it has the wrong order of selectors.</p>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1654255 by kwin on Fri, 23 Jan 2015 16:12:01 +0000
+        Rev. 1761914 by kwin on Thu, 22 Sep 2016 11:59:23 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project