You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2015/01/23 17:07:43 UTC

svn commit: r1654253 - /sling/site/trunk/content/documentation/the-sling-engine/url-to-script-resolution.mdtext

Author: kwin
Date: Fri Jan 23 16:07:43 2015
New Revision: 1654253

URL: http://svn.apache.org/r1654253
Log:
SLING-3440 explain multiple selector handling, node type resource types and add examples which won't match

Modified:
    sling/site/trunk/content/documentation/the-sling-engine/url-to-script-resolution.mdtext

Modified: sling/site/trunk/content/documentation/the-sling-engine/url-to-script-resolution.mdtext
URL: http://svn.apache.org/viewvc/sling/site/trunk/content/documentation/the-sling-engine/url-to-script-resolution.mdtext?rev=1654253&r1=1654252&r2=1654253&view=diff
==============================================================================
--- sling/site/trunk/content/documentation/the-sling-engine/url-to-script-resolution.mdtext (original)
+++ sling/site/trunk/content/documentation/the-sling-engine/url-to-script-resolution.mdtext Fri Jan 23 16:07:43 2015
@@ -15,7 +15,7 @@ Scripts and servlets are itself resource
 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). 
 
-For the Whole Truth about script resolution, see the [ScriptSelectionTest][1] class. If you see interesting cases that are not
+For the Whole Truth about script resolution, see the [ScriptSelectionTest](http://svn.apache.org/repos/asf/sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java) class. If you see interesting cases that are not
 covered there, please let us know via the Sling users mailing list.
 
 TODO: explain super types, servlet path mappings, node type resource types (`my:type -> my/type`) 
@@ -76,10 +76,10 @@ Depending on whether request selectors a
     
 The constituents of these script names are as follows: 
     
-* `{resourceTypeLabel}` - The last path segment of the path created from the resource type. This part is optional if the `{requestExtension}` is used in the script name. 
+* `{resourceTypeLabel}` - The last path segment of the path created from the resource type. This part is optional if the `{requestExtension}` is used in the script name. The resource type might either be set via the `sling:resourceType` property on the accessed node or if that property is not there its primary node type (property `jcr:primaryType`) is taken as fallback.
 * `{requestExtension}` - The request extension. This part may be ommitted if the request extension is "html", otherwise this part is required. If this part is ommitted, the `{resourceTypeLabel}` is required in the case of ignoring the selectors. 
 * `{scriptExtension}` - The extension, e.g. "esp" or "jsp", identifying the scripting langauage used. 
-* `{selectorStringPath}` - The selector string converted to a path, along the lines of `selectorString.replace('.', '/')`. 
+* `{selectorStringPath}` - The selector string converted to a path, along the lines of `selectorString.replace('.', '/')`. If less selectors are specified in the script name than given in the request, the script will only be taken into consideration if the given selectors are the **first** selectors in the request. This means *sel1/sel2.html.jsp* will be a candidate for the request url */content/test.sel1.sel2.sel3.html* but not for */content/test.sel3.sel1.sel2.html*. So the order of selectors is relevant!
     
 ## Priority 
     
@@ -91,7 +91,7 @@ The rules for script path priorization i
     
 ## Examples 
     
-Taking up again the list of potential script paths for a request of a resource whose resource type is sling:sample and the request selectors are "print.a4" and the request extension is "html" could be: 
+Taking up again the list of potential script paths for a request of a resource whose resource type is `sling\sample` and the request selectors are *print.a4* and the request extension is *html* could be: 
     
 * (0) GET.esp 
 * (1) sample.esp 
@@ -99,10 +99,8 @@ Taking up again the list of potential sc
 * (3) print.esp 
 * (4) print/a4.esp 
 * (5) print.html.esp 
-* (6) print/a4.html.esp 
+* (6) print/a4.html.esp
+* (7) a4.html.esp
+* (8) a4/print.html.esp 
     
-The priority of script selection would (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.
-    
-
-
-  [1]: http://svn.apache.org/repos/asf/sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/helper/ScriptSelectionTest.java
\ No newline at end of file
+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.
\ No newline at end of file