incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r820125 [3/4] - in /websites/staging/sling/trunk/content: ./ documentation/ documentation/bundles/ documentation/getting-started/ documentation/the-sling-engine/ documentation/the-sling-engine/authentication/ documentation/tutorials-how-tos/
Date Sun, 03 Jun 2012 17:58:07 GMT
Modified: websites/staging/sling/trunk/content/documentation/getting-started/discover-sling-in-15-minutes.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/getting-started/discover-sling-in-15-minutes.html (original)
+++ websites/staging/sling/trunk/content/documentation/getting-started/discover-sling-in-15-minutes.html Sun Jun  3 17:58:06 2012
@@ -85,12 +85,27 @@
       <p>The Sling Launchpad is a ready-to-run Sling configuration, providing an embedded JCR content repository and web server, a selection of Sling components, documentation and examples. The Launchpad makes it easy to get started with Sling and to develop script-based applications.</p>
 <p>This page will help you get started with the Launchpad. Fifteen minutes should be enough to get an overview of what Sling does.</p>
 <p>While simple to run and understand, the Launchpad is a full-featured instance of Sling, an example configuration that we have created with the most common modules and configurations. The full functionality of Sling is available by loading additional Sling (or custom) OSGi bundles as needed, using the Launchpad's web-based OSGi management console.</p>
+<div class="toc">
+<ul>
+<li><a href="#see-also">See Also</a></li>
+<li><a href="#prerequisites">Prerequisites</a></li>
+<li><a href="#start-the-launchpad">Start the Launchpad</a></li>
+<li><a href="#create-some-content">Create some content</a></li>
+<li><a href="#render-your-content-using-server-side-javascript-esp">Render your content using server-side javascript (ESP)</a></li>
+<li><a href="#what-next">What next?</a></li>
+<li><a href="#additional-examples">Additional examples</a><ul>
+<li><a href="#let-sling-generate-the-path-of-a-newly-created-node">Let Sling generate the path of a newly created node.</a></li>
+<li><a href="#add-a-page-header-with-slinginclude">Add a page header with sling.include</a></li>
+</ul>
+</li>
+</ul>
+</div>
 <h2 id="see-also">See Also</h2>
-<p>Example applications and mini-applications for Sling can be found under http://svn.apache.org/repos/asf/sling/trunk/samples/ (each application has a <code>README.txt</code> file, see these for more details).</p>
+<p>Example applications and mini-applications for Sling can be found under <a href="http://svn.apache.org/repos/asf/sling/trunk/samples/">http://svn.apache.org/repos/asf/sling/trunk/samples/</a> (each application has a <code>README.txt</code> file, see these for more details).</p>
 <p>Once you grok the basic examples of this page, we recommend studying the <em>espblog</em> and <em>webloader</em> samples for more complete examples. The <em>javashell</em> sample is useful to play with JCR java code (or any java code, for that matter) interactively.</p>
 <h2 id="prerequisites">Prerequisites</h2>
-<p>We'll start with the self-runnable jar from the Sling distribution, you only need a Java 5 JDK. Download the latest release from the Sling <a href="">Downloads</a> page or by clicking this link: [org.apache.sling.launchpad-6-standalone.jar|http://www.apache.org/dyn/closer.cgi/sling/org.apache.sling.launchpad-6-standalone.jar]. Alternatively you can deploy the [Sling Web application|http://www.apache.org/dyn/closer.cgi/sling/org.apache.sling.launchpad-6.war] into any decent Servlet Container such as Jetty or Tomcat or you can [build the current source yourself|Getting and Building Sling].</p>
-<p>To show the simplicity of the REST-style approach taken by Sling the examples below will be using <a href="">cURL</a>. Any HTTP client would do, but cURL is the easiest to document in a reproducible way.</p>
+<p>We'll start with the self-runnable jar from the Sling distribution, you only need a Java 5 JDK. Download the latest release from the Sling <a href="">Downloads</a> page or by clicking this link: <a href="http://www.apache.org/dyn/closer.cgi/sling/org.apache.sling.launchpad-6-standalone.jar">org.apache.sling.launchpad-6-standalone.jar</a>. Alternatively you can deploy the <a href="http://www.apache.org/dyn/closer.cgi/sling/org.apache.sling.launchpad-6.war">Sling Web application</a> into any decent Servlet Container such as Jetty or Tomcat or you can <a href="/documentation/development/getting-and-building-sling.html">build the current source yourself</a>.</p>
+<p>To show the simplicity of the REST-style approach taken by Sling the examples below will be using <a href="http://curl.haxx.se/">cURL</a>. Any HTTP client would do, but cURL is the easiest to document in a reproducible way.</p>
 <p>A WebDAV client makes editing server-side scripts much more convenient, but to make our examples easy to reproduce, we're using cURL below to create and update files in the JCR repository, via the Sling WebDAV server.</p>
 <h2 id="start-the-launchpad">Start the Launchpad</h2>
 <p>After downloading the Sling Launchpad self-runnable jar just start it as follows:</p>
@@ -99,20 +114,20 @@
 
 
 <p>This starts the Sling embedded Web Server on port 8080 and writes application files into the <code>sling</code> folder found in the current working directory.</p>
-<p>Once started, look at <a href="">http://localhost:8080/system/console/bundles</a> with your browser. Use <em>admin</em> with password <em>admin</em> if Sling asks you for a login. Sling then displays the <em>Felix Web Management Console</em> page.</p>
-<p>On the bundles page, all bundles should be marked <em>Active</em>. They're all <a href="">OSGi</a> bundles powered by [Apache Felix|http://felix.apache.org], but that doesn't really matter to us right now.</p>
+<p>Once started, look at <a href="http://localhost:8080/system/console/bundles">http://localhost:8080/system/console/bundles</a> with your browser. Use <em>admin</em> with password <em>admin</em> if Sling asks you for a login. Sling then displays the <em>Felix Web Management Console</em> page.</p>
+<p>On the bundles page, all bundles should be marked <em>Active</em>. They're all <a href="http://www.osgi.org/">OSGi</a> bundles powered by <a href="http://felix.apache.org">Apache Felix</a>, but that doesn't really matter to us right now.</p>
 <p>{tip:title=Log files}
 If things go wrong, have a look at the <code>sling/logs/error.log</code> log file - that's where Sling writes any error messages.
 {tip}</p>
 <h2 id="create-some-content">Create some content</h2>
 <p>Until we have ready-to-test forms, you can create content with cURL, or you can create an HTML form that posts to the specified URL.</p>
-<p>To create a content node (nodes are a <a href="">JCR</a> concept, a unit of storage) with cURL, use:</p>
+<p>To create a content node (nodes are a <a href="http://jackrabbit.apache.org/">JCR</a> concept, a unit of storage) with cURL, use:</p>
 <div class="codehilite"><pre><span class="n">curl</span> <span class="o">-</span><span class="n">u</span> <span class="n">admin:admin</span> <span class="o">-</span><span class="n">F</span><span class="s">&quot;sling:resourceType=foo/bar&quot;</span> <span class="o">-</span><span class="n">F</span><span class="s">&quot;title=some title&quot;</span> <span class="n">http:</span><span class="sr">//</span><span class="n">localhost:8080</span><span class="sr">/content/m</span><span class="n">ynode</span>
 </pre></div>
 
 
-<p>The resulting node can be seen at <a href="">http://localhost:8080/content/mynode.html</a>, or as json format under [http://localhost:8080/content/mynode.json|http://localhost:8080/content/mynode.json]. Lets try with cURL:</p>
-<div class="codehilite"><pre><span class="nv">$</span> <span class="nv">curl</span> <span class="n">http:</span><span class="sr">//</span><span class="n">localhost:8080</span><span class="sr">/content/m</span><span class="n">ynode</span><span class="o">.</span><span class="n">json</span>
+<p>The resulting node can be seen at <a href="http://localhost:8080/content/mynode.html.path">http://localhost:8080/content/mynode.html</a>, or as json format under <a href="http://localhost:8080/content/mynode.json">http://localhost:8080/content/mynode.json</a>. Lets try with cURL:</p>
+<div class="codehilite"><pre><span class="nv">$</span> <span class="nv">curl</span> <span class="n">http:</span><span class="sr">//</span><span class="n">localhost:8080</span><span class="sr">/content/m</span><span class="n">ynode</span><span class="o">.</span><span class="n">json</span>    
 <span class="p">{</span><span class="s">&quot;title&quot;</span><span class="p">:</span><span class="s">&quot;some title&quot;</span><span class="p">,</span><span class="s">&quot;sling:resourceType&quot;</span><span class="p">:</span><span class="s">&quot;foo/bar&quot;</span><span class="p">,</span><span class="s">&quot;jcr:primaryType&quot;</span><span class="p">:</span><span class="s">&quot;nt:unstructured&quot;</span><span class="p">}</span>
 </pre></div>
 
@@ -126,17 +141,21 @@ Sling provides a simple tool (an OSGi co
 <p>Several scripting languages are available as additional Sling modules (packaged as OSGi <em>bundles</em> that can be installed via the Sling management console), but the launchpad currently includes the ESP (server-side ECMAscript), JSP (Java Server Pages), and Groovy language modules by default.</p>
 <p>To select a script, Sling uses the node's <em>sling:resourceType</em> property, if it is set.</p>
 <p>That is the case in our example, so the following script will be used by Sling to render the node in HTML, if the script is found at <em>/apps/foo/bar/html.esp</em> in the repository.</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>html.esp</B></DIV><DIV class="codeContent panelContent">
-    <html>
-      <body>
-        <h1>&lt;%= currentNode.title %&gt;</h1>
-      </body>
-    </html></p>
-<p>To select the script, Sling:
-<em> looks under </em>/apps<em>
-</em> and appends the <em>sling:resourceType</em> value of our node ( which is <em>foo/bar</em> ) 
-<em> and appends </em>html.esp<em>, as the extension of our URL is </em>html<em> and the language of our script is </em>esp*.</p>
-<p>Store this script under <em>/apps/foo/bar/html.esp</em>, either using a WebDAV client (connected to <a href="">http://admin:admin@localhost:8080/</a>), or using cURL as shown here, after creating the <em>html.esp</em> script in the current directory on your system:</p>
+<div class="codehilite"><pre><span class="nt">&lt;html&gt;</span>
+  <span class="nt">&lt;body&gt;</span>
+    <span class="nt">&lt;h1&gt;</span><span class="cp">&lt;%=</span> <span class="n">currentNode</span><span class="o">.</span><span class="n">title</span> <span class="cp">%&gt;</span><span class="nt">&lt;/h1&gt;</span>
+  <span class="nt">&lt;/body&gt;</span>
+<span class="nt">&lt;/html&gt;</span>
+</pre></div>
+
+
+<p>To select the script, Sling:</p>
+<ul>
+<li>looks under <em>/apps</em></li>
+<li>and appends the <em>sling:resourceType</em> value of our node ( which is <em>foo/bar</em> ) </li>
+<li>and appends <em>html.esp</em>, as the extension of our URL is <em>html</em> and the language of our script is <em>esp</em>.</li>
+</ul>
+<p>Store this script under <em>/apps/foo/bar/html.esp</em>, either using a WebDAV client (connected to <a href="http://admin:admin@localhost:8080/">http://admin:admin@localhost:8080/</a>), or using cURL as shown here, after creating the <em>html.esp</em> script in the current directory on your system:</p>
 <div class="codehilite"><pre><span class="n">curl</span> <span class="o">-</span><span class="n">X</span> <span class="n">MKCOL</span> <span class="o">-</span><span class="n">u</span> <span class="n">admin:admin</span> <span class="n">http:</span><span class="sr">//</span><span class="n">localhost:8080</span><span class="sr">/apps/</span><span class="n">foo</span>
 <span class="n">curl</span> <span class="o">-</span><span class="n">X</span> <span class="n">MKCOL</span> <span class="o">-</span><span class="n">u</span> <span class="n">admin:admin</span> <span class="n">http:</span><span class="sr">//</span><span class="n">localhost:8080</span><span class="sr">/apps/</span><span class="n">foo</span><span class="o">/</span><span class="n">bar</span>
 </pre></div>
@@ -147,15 +166,15 @@ Sling provides a simple tool (an OSGi co
 </pre></div>
 
 
-<p>The HTML rendering of your node, at <a href="">http://localhost:8080/content/mynode.html</a>, is now created by this ESP script. You should see the node's title alone as an <h1> element in that page.</p>
-<p>A script named <em>POST.esp</em> instead of <em>html.esp</em> would be called for a POST request, <em>DELETE.esp</em> for DELETE, <em>xml.esp</em> for a GET request with a <em>.xml</em> extension, etc. See <a href="">URL to Script Resolution</a> on the Sling wiki for more info.</p>
+<p>The HTML rendering of your node, at <a href="http://localhost:8080/content/mynode.html">http://localhost:8080/content/mynode.html</a>, is now created by this ESP script. You should see the node's title alone as an &lt;h1&gt; element in that page.</p>
+<p>A script named <em>POST.esp</em> instead of <em>html.esp</em> would be called for a POST request, <em>DELETE.esp</em> for DELETE, <em>xml.esp</em> for a GET request with a <em>.xml</em> extension, etc. See <a href="/documentation/the-sling-engine/url-to-script-resolution.html">URL to Script Resolution</a> on the Sling wiki for more info.</p>
 <p>Servlets can also be easily "wired" to handle specific resource types, extensions, etc., in the simplest case by using SCR annotations in the servlet source code. Servlets and scripts are interchangeable when it comes to processing Sling requests.</p>
 <h2 id="what-next">What next?</h2>
 <p>These simple examples show how Sling uses scripts to work with JCR data, based on <em>sling:resourceType</em> or node types.</p>
 <p>There's much more to Sling of course - you'll find some additional simple examples below, and above in the <em>see also</em> section.</p>
-<p>We are working on debugging features to help trace the way Sling processes requests. Have a look at <a href="">SLING-3</a> to see what's possible already.</p>
-<h1 id="additional-examples">Additional examples</h1>
-<h2 id="let-sling-generate-the-path-of-a-newly-created-node">Let Sling generate the path of a newly created node.</h2>
+<p>We are working on debugging features to help trace the way Sling processes requests. Have a look at <a href="https://issues.apache.org/jira/browse/SLING-3">SLING-3</a> to see what's possible already.</p>
+<h2 id="additional-examples">Additional examples</h2>
+<h3 id="let-sling-generate-the-path-of-a-newly-created-node">Let Sling generate the path of a newly created node.</h3>
 <p>To create a node with a unique path at a given location, end the URL of the POST request with <em>/</em>.</p>
 <p>In this case, the Sling response redirects to the URL of the created node.</p>
 <p>Start by creating a new <em>/blog</em> folder:</p>
@@ -173,21 +192,23 @@ Sling provides a simple tool (an OSGi co
 </pre></div>
 
 
-<p>The actual node name might not be <em>adventures</em>with<em>slin</em> - depending on existing content in your repository, Sling will find a unique name for this new node, based on several well-know property values like title, description, etc. which are used for this if provided.</p>
-<p>So, in our case, our new node can be displayed in HTML via the <a href="">http://localhost:8080/blog/adventures<em>with</em>slin.html</a> URL.</p>
+<p>The actual node name might not be <em>adventures_with_slin</em> - depending on existing content in your repository, Sling will find a unique name for this new node, based on several well-know property values like title, description, etc. which are used for this if provided.</p>
+<p>So, in our case, our new node can be displayed in HTML via the <a href="http://localhost:8080/blog/adventures*with*slin.html">http://localhost:8080/blog/adventures_with_slin.html</a> URL.</p>
 <p>Note that we didn't set a <em>sling:resourceType</em> property on our node, so if you want to render that node with a script, you'll have to store the script under <em>/apps/nt/unstructured/html.esp</em>.</p>
-<h2 id="add-a-page-header-with-slinginclude">Add a page header with sling.include</h2>
+<h3 id="add-a-page-header-with-slinginclude">Add a page header with sling.include</h3>
 <p>The <em>sling.include</em> function can be called from scripts to include the rendered result of another node.</p>
 <p>In this example, we create a node at <em>/content/header</em>, rendered with a logo using an <em>html.esp</em> script, then use that header at the top of the <em>html.esp</em> script that we created previously for the <em>foo/bar</em> resource type.</p>
-<p>Start by checking that <a href="">http://localhost:8080/content/mynode.html</a> is rendered using the <em>html.esp</em> script created above.</p>
+<p>Start by checking that <a href="http://localhost:8080/content/mynode.html">http://localhost:8080/content/mynode.html</a> is rendered using the <em>html.esp</em> script created above.</p>
 <p>Create this script and name it <em>header.esp</em>:</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>header.esp</B></DIV><DIV class="codeContent panelContent">
-    <div>
-      <p style="color:blue;">
-        <img src="/images/sling.jpg" align="right"/>
-        &lt;%= currentNode.headline %&gt;
-      </p>
-    </div></p>
+<div class="codehilite"><pre><span class="nt">&lt;div&gt;</span>
+  <span class="nt">&lt;p</span> <span class="na">style=</span><span class="s">&quot;color:blue;&quot;</span><span class="nt">&gt;</span>
+    <span class="nt">&lt;img</span> <span class="na">src=</span><span class="s">&quot;/images/sling.jpg&quot;</span> <span class="na">align=</span><span class="s">&quot;right&quot;</span><span class="nt">/&gt;</span>
+    <span class="cp">&lt;%=</span> <span class="n">currentNode</span><span class="o">.</span><span class="n">headline</span> <span class="cp">%&gt;</span>
+  <span class="nt">&lt;/p&gt;</span>
+<span class="nt">&lt;/div&gt;</span>
+</pre></div>
+
+
 <p>Upload it so that it is used to render resources having <em>sling:resourceType=foo/header</em>:</p>
 <div class="codehilite"><pre><span class="n">curl</span> <span class="o">-</span><span class="n">X</span> <span class="n">MKCOL</span> <span class="o">-</span><span class="n">u</span> <span class="n">admin:admin</span> <span class="n">http:</span><span class="sr">//</span><span class="n">localhost:8080</span><span class="sr">/apps/</span><span class="n">foo</span><span class="sr">/header/</span>
 <span class="n">curl</span> <span class="o">-</span><span class="n">u</span> <span class="n">admin:admin</span> <span class="o">-</span><span class="n">T</span> <span class="n">header</span><span class="o">.</span><span class="n">esp</span> <span class="n">http:</span><span class="sr">//</span><span class="n">localhost:8080</span><span class="sr">/apps/</span><span class="n">foo</span><span class="sr">/header/</span><span class="n">html</span><span class="o">.</span><span class="n">esp</span>
@@ -195,7 +216,8 @@ Sling provides a simple tool (an OSGi co
 
 
 <p>Create the header node:</p>
-<div class="codehilite"><pre><span class="n">curl</span> <span class="o">-</span><span class="n">u</span> <span class="n">admin:admin</span> <span class="o">-</span><span class="n">F</span><span class="s">&quot;sling:resourceType=foo/header&quot;</span> <span class="o">-</span><span class="n">F</span><span class="s">&quot;headline=Hello, Sling world&quot;</span> <span class="n">http:</span><span class="sr">//</span><span class="n">localhost:8080</span><span class="sr">/content/</span><span class="n">header</span>
+<div class="codehilite"><pre><span class="n">curl</span> <span class="o">-</span><span class="n">u</span> <span class="n">admin:admin</span> <span class="o">-</span><span class="n">F</span><span class="s">&quot;sling:resourceType=foo/header&quot;</span> <span class="o">\</span>    
+    <span class="o">-</span><span class="n">F</span><span class="s">&quot;headline=Hello, Sling world&quot;</span> <span class="n">http:</span><span class="sr">//</span><span class="n">localhost:8080</span><span class="sr">/content/</span><span class="n">header</span>
 </pre></div>
 
 
@@ -205,25 +227,27 @@ Sling provides a simple tool (an OSGi co
 </pre></div>
 
 
-<p>And check that the header is rendered with the logo at <a href="">http://localhost:8080/content/header.html</a>.</p>
+<p>And check that the header is rendered with the logo at <a href="http://localhost:8080/content/header.html">http://localhost:8080/content/header.html</a>.</p>
 <p>Now, update the html.esp script that we created for our first example above, to include the header:</p>
-<p><DIV class="code panel" style="border-style: solid;border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;border-bottom-style: solid;"><B>html.esp</B></DIV><DIV class="codeContent panelContent">
-    <html>
-      <body>
-        <div id="header">
-          &lt;% sling.include("/content/header"); %&gt;
-        </div>
-        <h1>&lt;%= currentNode.title %&gt;</h1>
-      </body>
-    </html></p>
+<div class="codehilite"><pre><span class="nt">&lt;html&gt;</span>
+  <span class="nt">&lt;body&gt;</span>
+    <span class="nt">&lt;div</span> <span class="na">id=</span><span class="s">&quot;header&quot;</span><span class="nt">&gt;</span>
+      <span class="cp">&lt;%</span> <span class="n">sling</span><span class="o">.</span><span class="n">include</span><span class="p">(</span><span class="s2">&quot;/content/header&quot;</span><span class="p">);</span> <span class="cp">%&gt;</span>
+    <span class="nt">&lt;/div&gt;</span>
+    <span class="nt">&lt;h1&gt;</span><span class="cp">&lt;%=</span> <span class="n">currentNode</span><span class="o">.</span><span class="n">title</span> <span class="cp">%&gt;</span><span class="nt">&lt;/h1&gt;</span>
+  <span class="nt">&lt;/body&gt;</span>
+<span class="nt">&lt;/html&gt;</span>
+</pre></div>
+
+
 <p>And upload it again to replace the previous version:</p>
 <div class="codehilite"><pre><span class="n">curl</span> <span class="o">-</span><span class="n">u</span> <span class="n">admin:admin</span> <span class="o">-</span><span class="n">T</span> <span class="n">html</span><span class="o">.</span><span class="n">esp</span> <span class="n">http:</span><span class="sr">//</span><span class="n">localhost:8080</span><span class="sr">/apps/</span><span class="n">foo</span><span class="sr">/bar/</span><span class="n">html</span><span class="o">.</span><span class="n">esp</span>
 </pre></div>
 
 
-<p>The <a href="">http://localhost:8080/content/mynode.html</a>, once refreshed, now shows the blue headline and logo, and this layout also applies to any node created with <em>sling:resourceType=foo/bar</em>.</p>
+<p>The <a href="http://localhost:8080/content/mynode.html">http://localhost:8080/content/mynode.html</a>, once refreshed, now shows the blue headline and logo, and this layout also applies to any node created with <em>sling:resourceType=foo/bar</em>.</p>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1341376 by fmeschbe on Tue, 22 May 2012 09:41:06 +0000
+        Rev. 1345726 by fmeschbe on Sun, 3 Jun 2012 17:57:55 +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.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/the-sling-engine.html (original)
+++ websites/staging/sling/trunk/content/documentation/the-sling-engine.html Sun Jun  3 17:58:06 2012
@@ -91,6 +91,7 @@
 <ul>
 <li><a href="/documentation/the-sling-engine/dispatching-requests.html">Dispatching Requests</a></li>
 <li><a href="/documentation/the-sling-engine/url-decomposition.html">URL decomposition</a></li>
+<li><a href="/documentation/the-sling-engine/url-to-script-resolution.html">URL to Script Resolution</a></li>
 <li><a href="/documentation/the-sling-engine/request-listeners.html">Request Listeners</a></li>
 <li><a href="/documentation/the-sling-engine/filters.html">Filters</a></li>
 <li><a href="/documentation/the-sling-engine/servlets.html">Servlets and Scripts</a></li>
@@ -109,7 +110,7 @@
 <li><a href="/documentation/the-sling-engine/eventing-and-jobs.html">Eventing and Jobs</a></li>
 </ul>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1341376 by fmeschbe on Tue, 22 May 2012 09:41:06 +0000
+        Rev. 1345726 by fmeschbe on Sun, 3 Jun 2012 17:57:55 +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/authentication.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/the-sling-engine/authentication.html (original)
+++ websites/staging/sling/trunk/content/documentation/the-sling-engine/authentication.html Sun Jun  3 17:58:06 2012
@@ -87,7 +87,7 @@
 <p>This method is called by the OSGi HTTP Service implementation after the servlet has been selected to handle the request but before actually calling the servlet's <code>service</code> method.</p>
 <p>{section}
 {column}
-!authentication.png|thumbnail!
+<img alt="Authentication Flow" src="authentication.png" title="Authentication Flow" />
 {column}
 {column}
 1. First the OSGi HTTP Service implementation is analyzing the request URL to find a match for a servlet or resource registered with the HTTP Service.
@@ -104,7 +104,7 @@
 <li><a href="/documentation/the-sling-engine/authentication/authentication-authenticationhandler.html">AuthenticationHandler</a>: The {{AuthenticationHandler}} interface defines the service API which may be implemented by authentication handlers registered as OSGi services. </li>
 </ul>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1341376 by fmeschbe on Tue, 22 May 2012 09:41:06 +0000
+        Rev. 1345726 by fmeschbe on Sun, 3 Jun 2012 17:57:55 +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/authentication/authentication-authenticationhandler.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/the-sling-engine/authentication/authentication-authenticationhandler.html (original)
+++ websites/staging/sling/trunk/content/documentation/the-sling-engine/authentication/authentication-authenticationhandler.html Sun Jun  3 17:58:06 2012
@@ -84,14 +84,56 @@
       <h1>Authentication - AuthenticationHandler</h1>
       <p>The <code>AuthenticationHandler</code> interface defines the service API which may be implemented by authentication handlers registered as OSGi services.</p>
 <p><code>AuthenticationHandler</code> services have a single required service registration property which is used to identify requests to which the <code>AuthenticationHandler</code> service is applicable:</p>
-<p>| <code>path</code> | One or more (array or vector) string values indicating the request URLs to which the <code>AuthenticationHandler</code> is applicable. |
-| <code>authtype</code> | The authentication type implemented by this handler. This is a string value property and should be the same as will be used as the authentication type of the <code>AuthenticationInfo</code> object provided by the <code>extractCredentials</code> method. If this property is set, the <code>requestCredentials</code> method of the authentication handler is only called if the <code>sling:authRequestLogin</code> request parameter is either not set or is set to the same value as the <code>authtype</code> of the handler. This property is optional. If not set, the <code>requestCredentials</code> method is always called regardless of the value of the <code>sling:authRequestLogin</code> request parameter. |</p>
+<table>
+<thead>
+<tr>
+<th>Property</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><code>path</code></td>
+<td>One or more (array or vector) string values indicating the request URLs to which the <code>AuthenticationHandler</code> is applicable.</td>
+</tr>
+<tr>
+<td><code>authtype</code></td>
+<td>The authentication type implemented by this handler. This is a string value property and should be the same as will be used as the authentication type of the <code>AuthenticationInfo</code> object provided by the <code>extractCredentials</code> method. If this property is set, the <code>requestCredentials</code> method of the authentication handler is only called if the <code>sling:authRequestLogin</code> request parameter is either not set or is set to the same value as the <code>authtype</code> of the handler. This property is optional. If not set, the <code>requestCredentials</code> method is always called regardless of the value of the <code>sling:authRequestLogin</code> request parameter.</td>
+</tr>
+</tbody>
+</table>
 <p>Each path may be an absolute URL, an URL with just the host/port and path or just a plain absolute path:</p>
-<p>| URL part | Scheme | Host/Port | Path |
-| Absolute URL | must match | must match | request URL path is prefixed with the path |
-| Host/Port with Path | ignored | must match | request URL path is prefixed with the path |
-| Path | ignored | ignored | request URL path is prefixed with the path |</p>
-<p>When looking for an <code>AuthenticationHandler</code> the authentication handler is selected whose path is the longest match on the request URL. If the service is registered with Scheme and Host/Port, these must exactly match for the service to be eligible. If multiple <code>AuthenticationHandler</code> services are registered with the same length matching path, the handler with the higher service ranking is selected{footnote}Service ranking is defined by the OSGi Core Specification as follows: <em>If multiple qualifying service interfaces exist, a service with the highest <code>service.ranking</code> number, or when equal to the lowest <code>service.id</code>, determines which service object is returned by the Framework</em>.{footnote}.</p>
+<table>
+<thead>
+<tr>
+<th>URL part</th>
+<th>Scheme</th>
+<th>Host/Port</th>
+<th>Path</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>Absolute URL</td>
+<td>must match</td>
+<td>must match</td>
+<td>request URL path is prefixed with the path</td>
+</tr>
+<tr>
+<td>Host/Port with Path</td>
+<td>ignored</td>
+<td>must match</td>
+<td>request URL path is prefixed with the path</td>
+</tr>
+<tr>
+<td>Path</td>
+<td>ignored</td>
+<td>ignored</td>
+<td>request URL path is prefixed with the path</td>
+</tr>
+</tbody>
+</table>
+<p>When looking for an <code>AuthenticationHandler</code> the authentication handler is selected whose path is the longest match on the request URL. If the service is registered with Scheme and Host/Port, these must exactly match for the service to be eligible. If multiple <code>AuthenticationHandler</code> services are registered with the same length matching path, the handler with the higher service ranking is selected<sup id="fnref:ranking"><a href="#fn:ranking" rel="footnote">1</a></sup>.</p>
 <p>The value of <code>path</code> service registration property value triggering the call to any of the <code>AuthenticationHandler</code> methods is available as the <code>path</code> request attribute (for the time of the method call only). If the service is registered with multiple path values, the value of the <code>path</code> request attribute may be used to implement specific handling.</p>
 <h3 id="implementations-provided-by-sling">Implementations provided by Sling</h3>
 <ul>
@@ -112,9 +154,16 @@
 <li><code>requestCredentials</code> -- Send the login form for the user to provide the login parameters.</li>
 <li><code>dropCredentials</code> -- Clear the authentication cookie and internal store.</li>
 </ul>
-<p>///Footnotes Go Here///</p>
+<div class="footnote">
+<hr />
+<ol>
+<li id="fn:ranking">
+<p>Service ranking is defined by the OSGi Core Specification as follows: <em>If multiple qualifying service interfaces exist, a service with the highest <code>service.ranking</code> number, or when equal to the lowest <code>service.id</code>, determines which service object is returned by the Framework</em>.&#160;<a href="#fnref:ranking" rev="footnote" title="Jump back to footnote 1 in the text">&#8617;</a></p>
+</li>
+</ol>
+</div>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1341361 by fmeschbe on Tue, 22 May 2012 08:54:04 +0000
+        Rev. 1345726 by fmeschbe on Sun, 3 Jun 2012 17:57:55 +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/dispatching-requests.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/the-sling-engine/dispatching-requests.html (original)
+++ websites/staging/sling/trunk/content/documentation/the-sling-engine/dispatching-requests.html Sun Jun  3 17:58:06 2012
@@ -132,33 +132,61 @@ If any called filter doesn't call <code>
 <p>Note that these steps are processed for every include or forward call.</p>
 <h2 id="included-request-attributes">Included Request Attributes</h2>
 <p>When servlet or script is called as a result of <code>RequestDispatcher.include</code> the following request attributes are set:</p>
-<p>| Attribute Name
-Attribute Type | Description |
-| <code>org.apache.sling.api.include.servlet</code>
-<code>javax.servlet.Servlet</code> | The name of the request attribute containing the <code>Servlet</code> which included the servlet currently being active. |
-| <code>org.apache.sling.api.include.resource</code>
-<code>org.apache.sling.api.resource.Resource</code> | The name of the request attribute containing the <code>Resource</code> underlying the <code>Servlet</code> which included the servlet currently being active. |
-| <code>org.apache.sling.api.include.request*path*info</code>
-<code>org.apache.sling.api.request.RequestPathInfo</code> | The name of the request attribute containing the <code>RequestPathInfo</code> underlying the <code>Servlet</code> which included the servlet currently being active |
-| <code>javax.servlet.include.request_uri</code>
-<code>String</code> | The name of the request attribute containing the <code>HttpServletRequest.getRequestURI()</code> of the request which included the servlet currently being active underlying the <code>Servlet</code> which included the servlet currently being active.
-<em>Note:</em> In Sling, the <code>HttpServletRequest.getRequestURI()</code> method will always return the same result regardless of whether it is called from the client request processing servlet or script or from an included servlet or script. This request attribute is set for compatibility with the Servlet API specification. |
-| <code>javax.servlet.include.context_path</code>
-<code>String</code> | The name of the request attribute containing the <code>HttpServletRequest.getContextPath()</code> of the request which included the servlet currently being active underlying the <code>Servlet</code> which included the servlet currently being active.
-<em>Note:</em> In Sling, the <code>HttpServletRequest.getContextPath()</code> method will always return the same result regardless of whether it is called from the client request processing servlet or script or from an included servlet or script. This request attribute is set for compatibility with the Servlet API specification. |
-| <code>javax.servlet.include.servlet_path</code>
-<code>String</code> | The name of the request attribute containing the <code>HttpServletRequest.getServletPath()</code> of the request which included the servlet currently being active underlying the <code>Servlet</code> which included the servlet currently being active.
-<em>Note:</em> In Sling, the <code>HttpServletRequest.getServletPath()</code> method will always return the same result regardless of whether it is called from the client request processing servlet or script or from an included servlet or script. This request attribute is set for compatibility with the Servlet API specification. |
-| <code>javax.servlet.include.path_info</code>
-<code>String</code> | The name of the request attribute containing the <code>HttpServletRequest.getPathInfo()</code> of the request which included the servlet currently being active underlying the <code>Servlet</code> which included the servlet currently being active.
-<em>Note:</em> In Sling, the <code>HttpServletRequest.getPathInfo()</code> method will always return the same result regardless of whether it is called from the client request processing servlet or script or from an included servlet or script. This request attribute is set for compatibility with the Servlet API specification.
-| <code>javax.servlet.include.query_string</code>
-<code>String</code> | The name of the request attribute containing the <code>HttpServletRequest.getQueryString()</code> of the request which included the servlet currently being active underlying the <code>Servlet</code> which included the servlet currently being active.
-<em>Note:</em> In Sling, the <code>HttpServletRequest.getQueryString()</code> method will always return the same result regardless of whether it is called from the client request processing servlet or script or from an included servlet or script. This request attribute is set for compatibility with the Servlet API specification. |</p>
+<table>
+<thead>
+<tr>
+<th>Attribute Name</th>
+<th>Attribute Type</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><code>org.apache.sling.api.include.servlet</code></td>
+<td><code>javax.servlet.Servlet</code></td>
+<td>The name of the request attribute containing the <code>Servlet</code> which included the servlet currently being active.</td>
+</tr>
+<tr>
+<td><code>org.apache.sling.api.include.resource</code></td>
+<td><code>org.apache.sling.api.resource.Resource</code></td>
+<td>The name of the request attribute containing the <code>Resource</code> underlying the <code>Servlet</code> which included the servlet currently being active.</td>
+</tr>
+<tr>
+<td><code>org.apache.sling.api.include.request*path*info</code></td>
+<td><code>org.apache.sling.api.request.RequestPathInfo</code></td>
+<td>The name of the request attribute containing the <code>RequestPathInfo</code> underlying the <code>Servlet</code> which included the servlet currently being active</td>
+</tr>
+<tr>
+<td><code>javax.servlet.include.request_uri</code></td>
+<td><code>String</code></td>
+<td>The name of the request attribute containing the <code>HttpServletRequest.getRequestURI()</code> of the request which included the servlet currently being active underlying the <code>Servlet</code> which included the servlet currently being active.<br><em>Note:</em> In Sling, the <code>HttpServletRequest.getRequestURI()</code> method will always return the same result regardless of whether it is called from the client request processing servlet or script or from an included servlet or script. This request attribute is set for compatibility with the Servlet API specification.</td>
+</tr>
+<tr>
+<td><code>javax.servlet.include.context_path</code></td>
+<td><code>String</code></td>
+<td>The name of the request attribute containing the <code>HttpServletRequest.getContextPath()</code> of the request which included the servlet currently being active underlying the <code>Servlet</code> which included the servlet currently being active.<br><em>Note:</em> In Sling, the <code>HttpServletRequest.getContextPath()</code> method will always return the same result regardless of whether it is called from the client request processing servlet or script or from an included servlet or script. This request attribute is set for compatibility with the Servlet API specification.</td>
+</tr>
+<tr>
+<td><code>javax.servlet.include.servlet_path</code></td>
+<td><code>String</code></td>
+<td>The name of the request attribute containing the <code>HttpServletRequest.getServletPath()</code> of the request which included the servlet currently being active underlying the <code>Servlet</code> which included the servlet currently being active.<br><em>Note:</em> In Sling, the <code>HttpServletRequest.getServletPath()</code> method will always return the same result regardless of whether it is called from the client request processing servlet or script or from an included servlet or script. This request attribute is set for compatibility with the Servlet API specification.</td>
+</tr>
+<tr>
+<td><code>javax.servlet.include.path_info</code></td>
+<td><code>String</code></td>
+<td>The name of the request attribute containing the <code>HttpServletRequest.getPathInfo()</code> of the request which included the servlet currently being active underlying the <code>Servlet</code> which included the servlet currently being active.<br><em>Note:</em> In Sling, the <code>HttpServletRequest.getPathInfo()</code> method will always return the same result regardless of whether it is called from the client request processing servlet or script or from an included servlet or script. This request attribute is set for compatibility with the Servlet API specification.</td>
+</tr>
+<tr>
+<td><code>javax.servlet.include.query_string</code></td>
+<td><code>String</code></td>
+<td>The name of the request attribute containing the <code>HttpServletRequest.getQueryString()</code> of the request which included the servlet currently being active underlying the <code>Servlet</code> which included the servlet currently being active.<br><em>Note:</em> In Sling, the <code>HttpServletRequest.getQueryString()</code> method will always return the same result regardless of whether it is called from the client request processing servlet or script or from an included servlet or script. This request attribute is set for compatibility with the Servlet API specification.</td>
+</tr>
+</tbody>
+</table>
 <p>Constants are defined in the <code>org.apache.sling.api.SlingConstants</code> class for these request attributes.</p>
 <p><em>Note:</em> These request attributes are not set if the servlet or script is called to handle the request or as a result of <code>RequestDispatcher.forward</code>.</p>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1341376 by fmeschbe on Tue, 22 May 2012 09:41:06 +0000
+        Rev. 1345726 by fmeschbe on Sun, 3 Jun 2012 17:57:55 +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/request-parameters.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/the-sling-engine/request-parameters.html (original)
+++ websites/staging/sling/trunk/content/documentation/the-sling-engine/request-parameters.html Sun Jun  3 17:58:06 2012
@@ -84,21 +84,84 @@
       <h1>Request Parameter Handling in Sling</h1>
       <h2 id="servlet-api">Servlet API</h2>
 <p>The Servlet API specification provides the following methods to access the parameters of a request</p>
-<p>| <code>HttpServletRequest.getQueryString()</code> | Returns the query part of the request URL |
-| <code>ServletRequest.getParameter(String)</code> | Returns the (first) named parameter |
-| <code>ServletRequest.getParameterValues(String)</code> | Returns all parameters of that name |
-| <code>ServletRequest.getParameterMap()</code> | Returns all parameters as a map of <code>String[]()</code> |
-| <code>ServletRequest.getParameterNames()</code> | Returns an enumeration of the names of the parameters |</p>
+<table>
+<thead>
+<tr>
+<th>Method</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><code>HttpServletRequest.getQueryString()</code></td>
+<td>Returns the query part of the request URL</td>
+</tr>
+<tr>
+<td><code>ServletRequest.getParameter(String)</code></td>
+<td>Returns the (first) named parameter</td>
+</tr>
+<tr>
+<td><code>ServletRequest.getParameterValues(String)</code></td>
+<td>Returns all parameters of that name</td>
+</tr>
+<tr>
+<td><code>ServletRequest.getParameterMap()</code></td>
+<td>Returns all parameters as a map of <code>String[]()</code></td>
+</tr>
+<tr>
+<td><code>ServletRequest.getParameterNames()</code></td>
+<td>Returns an enumeration of the names of the parameters</td>
+</tr>
+</tbody>
+</table>
 <p>As a special restriction only two kinds of parameters are supported: (1) Query String parameters and (2) parameters contained in the request data of content type <code>application/x-www-form-encoded</code>. That is file uploads using request data of type <code>multipart/form-data</code> are not directly supported by the servlet specification. Finally the actual encoding of the parameters is all but safe because the encoding of URLs is not very well defined and browsers do not set the character encoding when sending post data. Fortunately, they use the same character encoding for sending back form content as was used by the server to send the form.</p>
 <h2 id="sling-api">Sling API</h2>
 <p>To overcome these restrictions and to provide uniform access to request parameters the Sling API in addition to the Servlet API methods to access parameters provides an abstraction of parameters which is applicable to all parameters sent by clients, the <code>RequestParameter</code> interface. Through this interface, each parameter may be analyzed for these topics:</p>
-<p>| Raw Content | Byte array and <code>InputStream</code> representation of the request parameter values. You will generally use the <code>InputStream</code> to handle uploaded files. |
-| String Content | Access the values as strings is some given encoding (see below) or by requesting the conversion using an explicit encoding. |
-| File Uploads | Find out whether a parameter is a file upload, get the size in bytes of the parameter value and client side file name as sent by the browser. |</p>
+<table>
+<thead>
+<tr>
+<th>Type</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td>Raw Content</td>
+<td>Byte array and <code>InputStream</code> representation of the request parameter values. You will generally use the <code>InputStream</code> to handle uploaded files.</td>
+</tr>
+<tr>
+<td>String Content</td>
+<td>Access the values as strings is some given encoding (see below) or by requesting the conversion using an explicit encoding.</td>
+</tr>
+<tr>
+<td>File Uploads</td>
+<td>Find out whether a parameter is a file upload, get the size in bytes of the parameter value and client side file name as sent by the browser.</td>
+</tr>
+</tbody>
+</table>
 <p>To accomodate this new interface as well as to provide easy access in the traditional way the <code>SlingHttpServletRequest</code> interface adds following methods to the standard Servlet API parameter access methods:</p>
-<p>| <code>getRequestParameter(String)</code> | Returns the (first) named parameter as a <code>RequestParameter</code> instance |
-| <code>getRequestParameters(String)</code> | Returns the named parameter as an array of <code>RequestParameter</code> instances |
-| <code>getRequestParameterMap()</code> | Returns <code>RequestParameterMap</code> being a map of <code>RequestParameter</code> arrays indexed by parameter names |</p>
+<table>
+<thead>
+<tr>
+<th>Method</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><code>getRequestParameter(String)</code></td>
+<td>Returns the (first) named parameter as a <code>RequestParameter</code> instance</td>
+</tr>
+<tr>
+<td><code>getRequestParameters(String)</code></td>
+<td>Returns the named parameter as an array of <code>RequestParameter</code> instances</td>
+</tr>
+<tr>
+<td><code>getRequestParameterMap()</code></td>
+<td>Returns <code>RequestParameterMap</code> being a map of <code>RequestParameter</code> arrays indexed by parameter names</td>
+</tr>
+</tbody>
+</table>
 <p>All parameters are handled the same, that is all methods give access to the same parameters regardless of whether the parameters were transmitted in the request query, as part of form encoded data or as part of a <code>multipart/form-data</code> request.</p>
 <p>As of Sling Engine 2.1.0 the order or request parameters in the <code>getRequestParameterMap()</code>, <code>getParameterMap()</code>, and <code>getParameterNams()</code> is preserved as follows:</p>
 <ul>
@@ -123,7 +186,7 @@
 Up to and including Sling Engine 2.2.2 request parameters are always decoded with ISO-8859-1 encoding if the <code>\*charset\*</code> request parameter is missing. As of Sling Engine 2.2.4 the <code>\*charset\*</code> request parameter is optional. As of this version the Sling Main Servlet supports a configuration setting which allows to change the default character encoding used if the <code>\*charset\*</code> request parameter is missing. To enable this functionality set the <code>sling.default.parameter.encoding</code> parameter of the Sling Main Servlet (PID <code>org.apache.sling.engine.impl.SlingMainServlet</code>) configuration to the desired encoding, which of course must be supported by the actual Java Platform.
 {info}</p>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1341376 by fmeschbe on Tue, 22 May 2012 09:41:06 +0000
+        Rev. 1345726 by fmeschbe on Sun, 3 Jun 2012 17:57:55 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project

Added: 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 (added)
+++ websites/staging/sling/trunk/content/documentation/the-sling-engine/url-to-script-resolution.html Sun Jun  3 17:58:06 2012
@@ -0,0 +1,180 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!--
+
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE- 2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+  <head>
+    <title>Apache Sling - URL to Script Resolution</title>
+    <link rel="stylesheet" href="/css/site.css" type="text/css" media="all">
+    <link rel="icon" href="http://sling.apache.org/site/media.data/favicon.ico">
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+  </head>
+  <body>
+    <div class="title">
+      <div class="logo">
+        <a href="http://sling.apache.org/site/index.html">
+          <img border="0" alt="Apache Sling" src="http://sling.apache.org/site/media.data/logo.png">
+        </a>
+      </div>
+      <div class="header">
+        <a href="http://www.apache.org/">
+          <img border="0" alt="Apache" src="http://sling.apache.org/site/media.data/apache.png">
+        </a>
+      </div>
+    </div>
+    
+    <div class="menu"> 
+      <p><strong>Documentation</strong> <br />
+<a href="/documentation/getting-started.html">Getting Started</a> <br />
+<a href="/documentation/the-sling-engine.html">The Sling Engine</a> <br />
+<a href="/documentation/development.html">Development</a> <br />
+<a href="/documentation/bundles.html">Bundles</a> <br />
+<a href="/documentation/tutorials-how-tos.html">Tutorials &amp; How-Tos</a> <br />
+<a href="/documentation/configuration.html">Configuration</a> <br />
+<a href="http://s.apache.org/sling.wiki">Wiki</a> <br />
+<a href="http://s.apache.org/sling.faq">FAQ</a> <br />
+<a href="/sitemap.html">Site Map</a></p>
+<p><strong>API Docs</strong>  <br />
+<a href="http://sling.apache.org/apidocs/sling6/index.html">Sling 6</a> <br />
+<a href="http://sling.apache.org/apidocs/sling5/index.html">Sling 5</a> <br />
+</p>
+<p><strong>Project info</strong> <br />
+<a href="/downloads.cgi">Downloads</a> <br />
+<a href="http://www.apache.org/licenses/">License</a> <br />
+<a href="/contributing.html">Contributing</a> <br />
+<a href="/news.html">News</a> <br />
+<a href="/links.html">Links</a> <br />
+<a href="/project-information.html">Project Information</a> <br />
+<a href="https://issues.apache.org/jira/browse/SLING">Issue Tracker</a> <br />
+<a href="http://svn.apache.org/viewvc/sling/trunk">Browse Source Repository</a> <br />
+<a href="/project-information/security.html">Security</a> <br />
+</p>
+<p><strong>Sponsorship</strong> <br />
+<a href="http://www.apache.org/foundation/thanks.html">Thanks</a> <br />
+<a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a> <br />
+<a href="http://www.apache.org/foundation/buy_stuff.html">Buy Stuff</a> <br />
+</p>
+<iframe 
+    src="http://www.apache.org/ads/button.html"
+    style="border-width:0; float: left" frameborder="0" 
+    scrolling="no"
+    width="135" 
+    height="135">
+</iframe>
+    </div>
+    
+    <div class="main">
+      <div class="breadcrump" style="font-size: 80%;">
+        <a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/documentation.html">Documentation</a>&nbsp;&raquo&nbsp;<a href="/documentation/the-sling-engine.html">The Sling Engine</a>
+      </div>
+      <h1>URL to Script Resolution</h1>
+      <p>{info:title=More information} 
+This page is currently a copy from <a href="http://markmail.org/message/tksvk4xfwapdpkwo">this mailing list thread</a>. See also [SLING-387|https://issues.apache.org/jira/browse/SLING-387] and the unit test <a href="http://svn.apache.org/repos/asf/incubator/sling/trunk/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/helper/ScriptSelectionTest.java">ScriptSelectionTest.java</a>.
+{info} </p>
+<div class="toc">
+<ul>
+<li><a href="#fundamental-scripts-and-servlets-are-equal">Fundamental: Scripts and Servlets are equal</a></li>
+<li><a href="#base-resource-type-inheritance">Base: Resource Type Inheritance</a></li>
+<li><a href="#script-locations">Script Locations</a></li>
+<li><a href="#all-requests-are-not-equal">All requests are NOT equal</a></li>
+<li><a href="#scripts-for-get-requests">Scripts for GET requests</a></li>
+<li><a href="#priority">Priority</a></li>
+<li><a href="#examples">Examples</a></li>
+</ul>
+</div>
+<p>This page explains how Sling maps URLs to a script or and servlet. 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 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>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</h2>
+<p>In the following discussion, I will write about scripts. This will always include servlets as well. In fact, internally, Sling only handles with Servlets, whereas scripts are packed inside a Servlet wrapping and representing the script. </p>
+<h2 id="base-resource-type-inheritance">Base: Resource Type Inheritance</h2>
+<p>While not exactly part of our discussion, resource type inheritance as implemented for <a href="https://issues.apache.org/jira/browse/SLING-278">SLING-278</a> plays a vital role in script resolution. </p>
+<p>Each resource type may have a resource super type, which may be defined in various ways. One example is having a <code>sling:resourceSuperType</code> property in the node addressed by the resource type. See <a href="http://www.mail-archive.com/sling-dev@incubator.apache.org/msg02365.html">http://www.mail-archive.com/sling-dev@incubator.apache.org/msg02365.html</a> and <a href="http://issues.apache.org/jira/browse/SLING-278">SLING-278</a> for more details. </p>
+<p>If a resource type has no explicit resource super type, the resource super type is assumed to be "sling/servlet/default". That is the resource type used for default script selection is also acting as a basic resource type much like java.lang.Object does for other types in the Java language. </p>
+<h2 id="script-locations">Script Locations</h2>
+<p>Scripts are looked up in a series of locations defined by the ResourceResolver.getSearchPath() and the resource type (and resource super types) of the requested resource: </p>
+<div class="codehilite"><pre><span class="p">{</span><span class="n">scriptPathPrefix</span><span class="p">}</span><span class="o">/</span><span class="p">{</span><span class="n">resourceTypePath</span><span class="p">}</span>
+</pre></div>
+
+
+<p>The pseudo code for iterating the locations would be something like: </p>
+<div class="codehilite"><pre><span class="n">var</span> <span class="n">type</span> <span class="o">=</span> <span class="n">resource</span><span class="o">.</span><span class="n">getResourceType</span><span class="p">();</span> 
+<span class="k">while</span> <span class="p">(</span><span class="n">type</span> <span class="o">!=</span> <span class="n">null</span><span class="p">)</span> <span class="p">{</span> 
+    <span class="k">for</span> <span class="p">(</span><span class="n">String</span> <span class="n">root:</span> <span class="n">resourceResolver</span><span class="o">.</span><span class="n">getSearchPath</span><span class="p">())</span> <span class="p">{</span> 
+        <span class="n">String</span> <span class="n">path</span> <span class="o">=</span> <span class="n">root</span> <span class="o">+</span> <span class="n">type</span><span class="o">.</span><span class="n">toPath</span><span class="p">();</span> 
+        <span class="n">findScriptsIn</span><span class="p">(</span><span class="n">path</span><span class="p">);</span> 
+    <span class="p">}</span>
+
+    <span class="k">if</span> <span class="p">(</span><span class="n">type</span> <span class="o">==</span> <span class="n">defaultServlet</span><span class="p">)</span> <span class="p">{</span> 
+        <span class="n">type</span> <span class="o">=</span> <span class="n">null</span><span class="p">;</span> 
+    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span> 
+        <span class="n">type</span> <span class="o">=</span> <span class="n">getResourceSuperType</span><span class="p">(</span><span class="n">type</span><span class="p">);</span> 
+        <span class="k">if</span> <span class="p">(</span><span class="n">type</span> <span class="o">==</span> <span class="n">null</span><span class="p">)</span> <span class="p">{</span> 
+            <span class="n">type</span> <span class="o">=</span> <span class="n">defaultServlet</span><span class="p">;</span> 
+        <span class="p">}</span> 
+    <span class="p">}</span> 
+<span class="p">}</span>
+</pre></div>
+
+
+<h2 id="all-requests-are-not-equal">All requests are NOT equal</h2>
+<p>GET and HEAD request methods are treated differently than the other request methods. Only for GET and HEAD requests will the request selectors and extension be considered for script selection. For other requests the servlet or script name (without the script extension) must exactly match the request method. </p>
+<p>That is for a PUT request, the script must be PUT.esp or PUT.jsp. For a GET request with a request extension of html, the script name may be html.esp or GET.esp. </p>
+<h2 id="scripts-for-get-requests">Scripts for GET requests</h2>
+<p>Apart for supporting scripts named after the request method, scripts handling GET and HEAD requests may be named differently for Sling to support a more elaborate processing order. </p>
+<p>Depending on whether request selectors are considered, a script may have two forms: </p>
+<ul>
+<li>a. Ignoring request selectors (e.g. there are none in the request URI) <code>{resourceTypeLabel}.{requestExtension}.{scriptExtension}</code> </li>
+<li>b. Handling request selectors <code>{selectorStringPath}.{requestExtension}.{scriptExtension}</code></li>
+</ul>
+<p>The constituents of these script names are as follows: </p>
+<ul>
+<li><code>{resourceTypeLabel}</code> - The last path segment of the path created from the resource type. This part is optional if the <code>{requestExtension}</code> is used in the script name. </li>
+<li><code>{requestExtension}</code> - 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 <code>{resourceTypeLabel}</code> is required in the case of ignoring the selectors. </li>
+<li><code>{scriptExtension}</code> - The extension, e.g. "esp" or "jsp", identifying the scripting langauage used. </li>
+<li><code>{selectorStringPath}</code> - The selector string converted to a path, along the lines of <code>selectorString.replace('.', '/')</code>. </li>
+</ul>
+<h2 id="priority">Priority</h2>
+<p>The rules for script path priorization is defined as follows: </p>
+<ul>
+<li>The more request selectors are matched, the better </li>
+<li>A script including the request extension matches better than one without a request extension (for html only) </li>
+<li>A script found earlier matches better than a script found later in the processing order. This means, that script closer to the original resource type in the resource type hierarchy is considered earlier. </li>
+</ul>
+<h2 id="examples">Examples</h2>
+<p>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: </p>
+<ul>
+<li>(0) GET.esp </li>
+<li>(1) sample.esp </li>
+<li>(2) html.esp </li>
+<li>(3) print.esp </li>
+<li>(4) print/a4.esp </li>
+<li>(5) print.html.esp </li>
+<li>(6) print/a4.html.esp </li>
+</ul>
+<p>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.</p>
+      <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+        Rev. 1345726 by fmeschbe on Sun, 3 Jun 2012 17:57:55 +0000
+      </div>
+      <div class="trademarkFooter"> 
+        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.
+      </div>
+    </div>
+  </body>
+</html>



Mime
View raw message