incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r818667 [16/18] - in /websites/staging/sling/trunk/content: ./ authentication/ documentation/ documentation/bundles/ documentation/development/ documentation/getting-started/ documentation/the-sling-engine/ documentation/the-sling-engine/au...
Date Tue, 22 May 2012 09:41:27 GMT
Added: websites/staging/sling/trunk/content/old-stuff/request-processing.html
==============================================================================
--- websites/staging/sling/trunk/content/old-stuff/request-processing.html (added)
+++ websites/staging/sling/trunk/content/old-stuff/request-processing.html Tue May 22 09:41:22 2012
@@ -0,0 +1,221 @@
+<!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 - Request Processing</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="/getting-started.html">Getting Started</a> <br />
+<a href="/the-sling-engine.html">The Sling Engine</a> <br />
+<a href="/development.html">Development</a> <br />
+<a href="/bundles.html">Bundles</a> <br />
+<a href="/tutorials-how-tos.html">Tutorials &amp; How-Tos</a> <br />
+<a href="/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="http://sling.apache.org/site/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="/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="/old-stuff.html">Old Stuff</a>
+      </div>
+      <h1>Request Processing</h1>
+      <p>{note:title=Page Status}
+2008-02-13: this page is <em>out of sync</em> with the current codebase, needs to be reviewed and updated.
+{note}</p>
+<p>One of the core problems towards understanding how Sling works is knowing how a Client Request is processed by Sling. This page describes the flow of processing requests inside Sling.</p>
+<h2 id="core-request-processing">Core Request Processing</h2>
+<p>The HTTP request enters Sling in the <code>org.apache.sling.core.ComponentRequestHandlerImpl.service(ServletRequest req, ServletResponse res)</code> method as the <code>ComponentRequestHandlerImpl</code> is registered as the Servlet handling HTTP requests. This method sets up the initial <code>ComponentRequest</code> and <code>ComponentResponse</code> objects and hands the request over to the first <code>ComponentFilterChain</code>. This first filter chain calls all <code>ComponentFilter</code> instances registered as request level filters. After processing all filters in the request level filter chain, the request is handed over to the second <code>ComponentFilterChain</code> which calls all <code>ComponentFilter</code> instances registered as component level filters. At the end of the second filter chain the <code>service</code> method of the actual <code>Component</code> to which the request resolved is called.</p>
+<p>As the component is now processing the request, it may decide to dispatch the request to some other content such as for example a paragraph system or navigation component. To do this, the component will call the <code>RequestDispatcher.include</code> method. If the request dispatcher dispatches to a <code>Content</code> object Sling will hand the dispatch request over to the component level filter chain, which at the end will call the <code>service</code> method for the <code>Content</code> object to dispatched to. This process may be repeated at the component's discretion only limited by processing resources such as available memory.</p>
+<p>As can be seen Sling itself is absed on the Component API <code>ComponentFilter</code> mechanism. As such Sling provides and uses the following filters in the Sling Core bundle:</p>
+<p>{table:class=confluenceTable}
+{tr}{th:colspan=2|class=confluenceTh} Request Level Filters {th}{tr}
+{tr}{td:class=confluenceTd} <code>ErrorHandlerFilter</code> {td}{td:class=confluenceTd} Handles exceptions thrown while processing the request as well implements the <code>ComponentResponse.sendError()</code> method {td}{tr}
+{tr}{td:class=confluenceTd} <code>AuthenticationFilter</code> {td}{td:class=confluenceTd} Implements authentication for the request and provides the JCR Session of the request {td}{tr}
+{tr}{td:class=confluenceTd} <code>BurstCacheFilter</code> {td}{td:class=confluenceTd} Checks whether the request may be handled by cached response data {td}{tr}
+{tr}{td:class=confluenceTd} <code>LocaleResolverFilter</code> {td}{td:class=confluenceTd} Provides information on the <code>Locale</code> to be used for request processing. This filter implements the <code>ComponentRequest.getLocale()</code> method {td}{tr}
+{tr}{td:class=confluenceTd} <code>ThemeResolverFilter</code> {td}{td:class=confluenceTd} Provides the <code>Theme</code> for the request. The theme is provided as a request attribute {td}{tr}
+{tr}{td:class=confluenceTd} <code>URLMapperFilter</code> {td}{td:class=confluenceTd} Resolves the request URL to a JCR Node which may be mapped into a <code>Content</code> object {td}{tr}
+{tr}{td:class=confluenceTd} <code>ZipFilter</code> {td}{td:class=confluenceTd} Sample filter showing how the request response might be compressed according to the <em>Accept-Encoding</em> request header. This filter is not enabled by default. {td}{tr}
+{table}</p>
+<p>Deducing from these lists of filters, the actual request processing can be refined into the following steps:</p>
+<ol>
+<li>Extract user authentication information and acquire the JCR session to access content. If the request has no user authentication data the such data may be requested from the user (for example by sending a HTTP 401 status) or an anonymous repository session might be acquired.</li>
+<li>Check whether the request may be handled by data stored in the cache. If the request is cacheable and a cache entry exists for the request URL, the request data is returned to the client and request processing may terminate. Otherwise request processing will continue and optionally ensure that any response data is entered into the cache. Of course, if the request is not cacheable, for example because there are request parameters, or if any of the <code>Component</code> instances called during request processing decide to signal non-cacheability for whatever reason, the response data will of course not cached.</li>
+<li>Extract the <code>java.util.Locale</code> from the request such that further processing may use properly translated messages. By default, the locale of the underlying Servlet request is used as the request locale. Other possibilities would be to use special cookies or some locale encoding in the path.</li>
+<li>Find the theme (or skin) to use to render the response. This step will add a <code>org.apache.sling.theme.Theme</code> object as a request parameter, which may be used by <code>Component</code>s to decide on specific rendering. For example, the theme may encapsulate information on the CSS to use for responses rendered as HTML.</li>
+<li>Resolve the request URL into a <code>Content</code> object.</li>
+</ol>
+<p>The default request level filter chain setup ends with finding the <code>Content</code> object requested by the request URL. After having found this object, the request is handed over to the component level filter chain, which is concerned with handling filtering on a single <code>Content</code> instance. As such, the component level filter chain is used for each <code>Content</code> object which is to be serviced either on behalf of the HTTP request or on behalf of request dispatcher. Thus the component level filter chain will generally called multiple times during a single request.</p>
+<p>{table:class=confluenceTable}
+{tr}{th:colspan=2|class=confluenceTh} Component Level Filters {th}{tr}
+{tr}{td:class=confluenceTd} <code>CacheFilter</code> {td}{td:class=confluenceTd} Checks whether the request to the current <code>Content</code> object may be handled by cached response data {td}{tr}
+{tr}{td:class=confluenceTd} <code>ComponentResolverFilter</code> {td}{td:class=confluenceTd} Resolves the component ID returned by the <code>Content.getComponentId()</code> method into a <code>Component</code> instances, which will be called to service the request {td}{tr}
+{table}</p>
+<p>Again, deducing from the list of filters, the following steps are taking to service a given <code>Content</code> object:</p>
+<ol>
+<li>Check whether the <code>Content</code> object processing may be handled from the cache. Same as with request level cache handling, a cache entry may exist for a single <code>Content</code> instance depending on whether the request is cacheable at all and on whether a cache entry exists. If a cache entry exists and may be used, the response data is simply spooled into the response and component level processing terminates for the <code>Content</code> object. Otherwise processing continues and may optionally lead to a new cache entry for the <code>Content</code> object to be reused later.</li>
+<li>Resolve the component ID returned by the <code>Content.getComponentId()</code> method into a <code>Component</code> object. Of course it is an error, if the component ID cannot be mapped into a <code>Component</code> object.</li>
+</ol>
+<p>After resolving the <code>Component</code> object default component filter chain terminates and control is handed over to the <code>service</code> method of the <code>Component</code> object resolved in the last step. At the discretion of the component request dispatchers may now be acquired to render other <code>Content</code> objects. In this case the component level filter chain is simply kicked of again resulting in the <code>service</code> method of another <code>Component</code> being called. And so forth.</p>
+<h2 id="resolving-content">Resolving Content</h2>
+<p>As we have seen, the last step in the request level filter chain is the resolution of the request URL into a <code>Content</code> object. The URL Mapper Filter implementing this resolution uses an instance of the <code>org.apache.sling.content.ContentMapper</code> interface which is acquired by calling the <code>org.apache.sling.content.jcr.JcrContentManagerFactory</code> with the repository session acquired by the authentication filter.</p>
+<p>The URL Mapper filter then tries to apply fixed mappings from request URL to destination paths to support shortcut URLs. For example the root path <code>/</code> may be mapped into the default landing page at <code>/default/home</code>. The list of such mappings is configurable through the Configuration Admin Service.</p>
+<p>Next the URL Mapper tries to apply prefix matching patterns. A list of patterns is iterated checking whether the prefix applies and, if so, replacing the prefix with another prefix and trying to resolve the result. This functionality enables relocation of a subtree of the repository. For example, all requests whose prefix is <code>/here</code> might be remapped with the new prefix <code>/content/there</code>. The result  of this remapping is then resolved.</p>
+<p>Resolution (currently) takes place on the last path segment of the request URL containing at least one dot. Parts of that segment are cut off after dots until no more dots exist in the URL. For each resulting substring, the <code>ContentManager.load(String)</code> method is called. This processing terminates if a <code>Content</code> object is found or if there is nothing to cut off any more.</p>
+<p>This resolution is very simple and straight forwards. Future development may add support for the following features:</p>
+<ul>
+<li><em>Vanity URLs</em> - Map the request URL according to the <code>Host</code> request header.</li>
+<li><em>Dynamic Mapping</em> - Add support for a set of variables in path and/or prefix mapping. For example, a prefix mapping  may contain the string <code>/content/$\{lang}/$\{user</code>} resulting in resolving a prefix according to the language of the current locale and the name of the authenticated used.</li>
+</ul>
+<h2 id="registering-components">Registering Components</h2>
+<p>The last step of the component level filter chain is resolving the <code>Component</code> from the component ID of the <code>Content</code> object. Sling implements this resolution by making use of the OSGi service registry. That is, each component is to be registered as a service with the name <code>org.apache.sling.component.Component</code>. The <code>ComponentResolverFilter</code> is listening for these components and registers them internally in a map indexed by the IDs of the component as returned by the <code>Component.getId()</code> method.</p>
+<p>When a component has to be resolved, the component ID returned by the <code>Content</code> object is simply looked up in the component map. If found, that component is used. Otherwise a fall back algorithm is applied which is described on the <a href="/documentation/the-sling-engine/default-mapping-and-rendering.html">Default Content Mapping and Request Rendering</a> page.</p>
+<h2 id="reqistering-filters">Reqistering Filters</h2>
+<p>Just as <code>Component</code> instances used by Sling are expected to be registered as OSGi services, the <code>ComponentFilter</code>s to be 
+used have to be registered as services under the name <code>org.apache.sling.component.ComponentFilter</code>. Sling picks up all registered component filters and adds them to the respective filter chains.</p>
+<p>Service properties set upon registration of the filter define the chain to which the filter belongs and the order in which the filters should be processed:</p>
+<table>
+<thead>
+<tr>
+<th>Property</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><code>filter.scope</code></td>
+<td>Defines the chain to which the filter is added. Supported values are <code>component</code> for component level filters and <code>request</code> for request level filters. If this property is missing or set to an unknown value the filter is added to the request level filter chain.</td>
+</tr>
+<tr>
+<td><code>filter.order</code></td>
+<td>Defines the weight of the filter to resolve the processing order. This property must be an <code>java.lang.Integer</code>. If not set or not an <code>Integer</code> the order defaults to <code>Integer.MAX_VALUE</code>. The lower the order number the earlier in the filter chain will the filter be inserted. If two filters are registered with the same order value, the filter with the lower <code>service.id</code> value is called first.</td>
+</tr>
+</tbody>
+</table>
+<h2 id="content-is-a-java-object">Content is a Java Object</h2>
+<p>It is crucial to understand that <code>Content</code> is an interface and the request processor of Sling does not actually care, how the <code>Content</code> instance comes to live as long as the is such an object and there is a <code>Component</code> instance capable of servicing the <code>Content</code> object.</p>
+<p>By default Sling uses the <em>URL Mapper</em> to resolve the request URL into a <code>Content</code> object. When a <code>Component</code> is tasked with servicing a <code>Content</code> object it usually uses the <code>ComponentRequestDispatcher</code> to ask Sling to service another content object generally identified by a (relative or absolute) path to a JCR Repository Node from which the <code>Content</code> object is loaded.</p>
+<p>But instead of having Sling resolve a path into a <code>Content</code> object the component may just as well create a <code>Content</code> object and hand it over to the <code>ComponentRequestDispatcher</code> for service. Consider a request which is handled by a <code>PageComponent</code>. This component has to draw a navigation tree somewhere in the response. So the component could of course insist on having a <code>navigation</code> child node to dispatch rendering to as follows:</p>
+<div class="codehilite"><pre><span class="n">RequestDispatcher</span> <span class="n">rd</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">getRequestDispatcher</span><span class="p">(</span><span class="s">&quot;navigation&quot;</span><span class="p">);</span>
+<span class="n">rd</span><span class="o">.</span><span class="n">include</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">response</span><span class="p">);</span>
+</pre></div>
+
+
+<p>What happens, though, if there is no <code>navigation</code> child node ? Probably, the request will fail with some error status. Of course the component could be more clever and do:</p>
+<div class="codehilite"><pre><span class="n">Content</span> <span class="n">navigation</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">getContent</span><span class="p">(</span><span class="s">&quot;navigation&quot;</span><span class="p">);</span>
+<span class="k">if</span> <span class="p">(</span><span class="n">navigation</span> <span class="o">!=</span> <span class="n">null</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">RequestDispatcher</span> <span class="n">rd</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">getRequestDispatcher</span><span class="p">(</span><span class="n">navigation</span><span class="p">);</span>
+    <span class="n">rd</span><span class="o">.</span><span class="n">include</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">response</span><span class="p">);</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<p>Still, if the <code>navigation</code> child node does not exist, there is no navigation drawn; at least there will be now error. Since Sling does not actually care, how a <code>Content</code> object comes to live, the component could do the following:</p>
+<div class="codehilite"><pre><span class="n">Content</span> <span class="n">navigation</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Content</span><span class="p">()</span> <span class="p">{</span>
+    <span class="n">public</span> <span class="n">String</span> <span class="n">getPath</span><span class="p">()</span> <span class="p">{</span>
+        <span class="k">return</span> <span class="n">request</span><span class="o">.</span><span class="n">getContent</span><span class="p">()</span><span class="o">.</span><span class="n">getPath</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;/navigation&quot;</span><span class="p">;</span>
+    <span class="p">}</span>
+    <span class="n">public</span> <span class="n">String</span> <span class="n">getComponentId</span><span class="p">()</span> <span class="p">{</span>
+        <span class="k">return</span> <span class="n">NavigationComponent</span><span class="o">.</span><span class="n">getClass</span><span class="p">()</span><span class="o">.</span><span class="n">getName</span><span class="p">();</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="n">RequestDispatcher</span> <span class="n">rd</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">getRequestDispatcher</span><span class="p">(</span><span class="n">navigation</span><span class="p">);</span>
+<span class="n">rd</span><span class="o">.</span><span class="n">include</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">response</span><span class="p">);</span>
+</pre></div>
+
+
+<p>Of course, the page component now has to have knowledge about the actual <code>Component</code> to use.</p>
+<p>Finally, as a further enhancement, the Component might even decide to first check for a <code>navigation</code> child node. If such a node does not exist the navigation <code>Content</code> object is just created:</p>
+<div class="codehilite"><pre><span class="n">Content</span> <span class="n">navigation</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">getContent</span><span class="p">(</span><span class="s">&quot;navigation&quot;</span><span class="p">);</span>
+<span class="k">if</span> <span class="p">(</span><span class="n">navigation</span> <span class="o">==</span> <span class="n">null</span><span class="p">)</span> <span class="p">{</span>
+    <span class="n">navigation</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Content</span><span class="p">()</span> <span class="p">{</span>
+        <span class="n">public</span> <span class="n">String</span> <span class="n">getPath</span><span class="p">()</span> <span class="p">{</span>
+            <span class="k">return</span> <span class="n">request</span><span class="o">.</span><span class="n">getContent</span><span class="p">()</span><span class="o">.</span><span class="n">getPath</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;/navigation&quot;</span><span class="p">;</span>
+        <span class="p">}</span>
+        <span class="n">public</span> <span class="n">String</span> <span class="n">getComponentId</span><span class="p">()</span> <span class="p">{</span>
+            <span class="k">return</span> <span class="n">NavigationComponent</span><span class="o">.</span><span class="n">getClass</span><span class="p">()</span><span class="o">.</span><span class="n">getName</span><span class="p">();</span>
+        <span class="p">}</span>
+    <span class="p">}</span>
+<span class="p">}</span>
+
+<span class="n">RequestDispatcher</span> <span class="n">rd</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">getRequestDispatcher</span><span class="p">(</span><span class="n">navigation</span><span class="p">);</span>
+<span class="n">rd</span><span class="o">.</span><span class="n">include</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">response</span><span class="p">);</span>
+</pre></div>
+
+
+<p>This could for example be used to fall back to a default navigation setup while providing for specialized navigation configuration in an optional <code>navigation</code> child node.</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
+      </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>

Added: websites/staging/sling/trunk/content/old-stuff/run-modes-org-apache-sling-runmode.html
==============================================================================
--- websites/staging/sling/trunk/content/old-stuff/run-modes-org-apache-sling-runmode.html (added)
+++ websites/staging/sling/trunk/content/old-stuff/run-modes-org-apache-sling-runmode.html Tue May 22 09:41:22 2012
@@ -0,0 +1,125 @@
+<!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 - Run Modes (org.apache.sling.runmode)</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="/getting-started.html">Getting Started</a> <br />
+<a href="/the-sling-engine.html">The Sling Engine</a> <br />
+<a href="/development.html">Development</a> <br />
+<a href="/bundles.html">Bundles</a> <br />
+<a href="/tutorials-how-tos.html">Tutorials &amp; How-Tos</a> <br />
+<a href="/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="http://sling.apache.org/site/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="/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="/old-stuff.html">Old Stuff</a>
+      </div>
+      <h1>Run Modes (org.apache.sling.runmode)</h1>
+      <p>{note}
+As of Sling 6 the <code>org.apache.sling.runmode</code> bundle is replaced by the new <a href="/documentation/bundles/sling-settings-org-apache-sling-settings.html">Sling Settings (org.apache.sling.settings)</a> Bundle. For backwards compatibility this bundle may still exist in your environment. New code should use the API of the new [Sling Settings (org.apache.sling.settings)] Bundle, though.
+{note}</p>
+<h1 id="overview">Overview</h1>
+<p>Run modes are meant to define different sets of configuration parameters for various Sling instances.</p>
+<p>In a web publishing environment, for example, one could use run modes like <em>staging, production, dev, dmz</em> or combinations of such values.</p>
+<p>The <em><a href="">org.apache.sling.runmode</a></em> bundle provides a simple way of defining and querying a list of run modes.</p>
+<h1 id="installation">Installation</h1>
+<p>The run mode service is not present in the default Sling launchpad builds, to activate it install and start the <em>org.apache.sling.runmode</em> bundle.</p>
+<h1 id="configuration">Configuration</h1>
+<p>Run modes can only be configured using a system property, or via the <em>sling.properties</em> file.</p>
+<p>Using <em>-Dsling.run.modes=foo,bar</em> on the JVM command-line, for example, activates the <em>foo</em> and <em>bar</em> run modes. </p>
+<p>This command-line parameter takes precedence over a similar definition (<em>sling.run.modes=dev,staging</em>) that might be present in the <em>sling.properties</em> file found in the Sling home directory.</p>
+<h1 id="getting-the-current-list-of-run-modes">Getting the current list of run modes</h1>
+<p>The <a href="">RunMode service</a> provides the current list of run modes, examples:</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>RunMode examples</B></DIV><DIV class="codeContent panelContent">
+    RunMode r = ...get from BundleContext...
+    String [] currentRunModes = r.getCurrentRunModes();</p>
+<div class="codehilite"><pre><span class="n">String</span> <span class="o">[]</span> <span class="n">expectedRunModes</span> <span class="o">=</span> <span class="p">{</span> <span class="s">&quot;foo&quot;</span><span class="p">,</span> <span class="s">&quot;wii&quot;</span> <span class="p">};</span>
+<span class="k">if</span><span class="p">(</span><span class="n">r</span><span class="o">.</span><span class="n">isActive</span><span class="p">(</span><span class="n">expectedRunModes</span><span class="p">))</span> <span class="p">{</span>
+  <span class="sr">//</span> <span class="n">at</span> <span class="n">least</span> <span class="n">one</span> <span class="n">of</span> <span class="p">(</span><span class="n">foo</span><span class="p">,</span><span class="n">wii</span><span class="p">)</span> <span class="n">run</span> <span class="n">modes</span>
+  <span class="sr">//</span> <span class="n">is</span> <span class="n">active</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<h1 id="see-also">See also</h1>
+<p>The RunMode service is used by the <a href="/documentation/bundles/jcr-installer-provider.html">jcrinstall</a> services.</p>
+<h1 id="automated-tests">Automated tests</h1>
+<p>The <a href="">RunModeImplTest class</a> provides more info about run modes parsing and usage.</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
+      </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>

Added: websites/staging/sling/trunk/content/old-stuff/scriptengineintegration.html
==============================================================================
--- websites/staging/sling/trunk/content/old-stuff/scriptengineintegration.html (added)
+++ websites/staging/sling/trunk/content/old-stuff/scriptengineintegration.html Tue May 22 09:41:22 2012
@@ -0,0 +1,108 @@
+<!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 - Integrating Scripting Languages</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="/getting-started.html">Getting Started</a> <br />
+<a href="/the-sling-engine.html">The Sling Engine</a> <br />
+<a href="/development.html">Development</a> <br />
+<a href="/bundles.html">Bundles</a> <br />
+<a href="/tutorials-how-tos.html">Tutorials &amp; How-Tos</a> <br />
+<a href="/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="http://sling.apache.org/site/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="/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="/old-stuff.html">Old Stuff</a>
+      </div>
+      <h1>Integrating Scripting Languages</h1>
+      <p>This page should be extended with more concrete and detailed information. For now, we have the following information:</p>
+<ul>
+<li>There will be a talk at ApacheCon US 08 in New Orleans about creating JSR-223 ScriptEngineFactory and ScriptEngine implementaitons as well as how to integrate such implementations with Sling.</li>
+<li>From a mail on the mailing list, this is a very condensed how-to:
+         <strong> Create the ScriptEngine[Factory]() implementations
+         </strong> Create a bundle comprising the above implementations as well as the script language implementation.
+         ** Create the <code>META-INF/services/javax.script.ScriptEngineFactory</code> file listing the fully qualified name of your ScriptEngineFactory implementaiton</li>
+</ul>
+<h1 id="notes-on-scriptengines">Notes on ScriptEngines</h1>
+<ul>
+<li><a href="/old-stuff/scriptengineintegration/groovy-support.html">Groovy Support</a></li>
+<li><a href="/old-stuff/scriptengineintegration/xslt-processing-pipeline.html">XSLT Processing Pipeline</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
+      </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>

Added: websites/staging/sling/trunk/content/old-stuff/scriptengineintegration/groovy-support.html
==============================================================================
--- websites/staging/sling/trunk/content/old-stuff/scriptengineintegration/groovy-support.html (added)
+++ websites/staging/sling/trunk/content/old-stuff/scriptengineintegration/groovy-support.html Tue May 22 09:41:22 2012
@@ -0,0 +1,144 @@
+<!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 - Groovy Support</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="/getting-started.html">Getting Started</a> <br />
+<a href="/the-sling-engine.html">The Sling Engine</a> <br />
+<a href="/development.html">Development</a> <br />
+<a href="/bundles.html">Bundles</a> <br />
+<a href="/tutorials-how-tos.html">Tutorials &amp; How-Tos</a> <br />
+<a href="/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="http://sling.apache.org/site/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="/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="/old-stuff.html">Old Stuff</a>&nbsp;&raquo&nbsp;<a href="/old-stuff/scriptengineintegration.html">Integrating Scripting Languages</a>
+      </div>
+      <h1>Groovy Support</h1>
+      <p>After meeting Paul King of the Groovy Team at Apache Con US 08 in New Orleans, I set out to take a stab at SLING-315 again to add Groovy support to Sling. It turned out, that the current Groovy 1.6 branch already contains the required setup to build the <code>groovy-all.jar</code> as an OSGi Bundle, which is directly usable with Sling by just installing that bundle.</p>
+<p>Currently the Groovy team is working hard towards the 1.6 release and many things are in flux, which is really great.</p>
+<p>So, on 11. Dec. 2008 Paul King of the Groovy Team has deployed a <a href="">first RC1 Snapshot of Groovy 1.6</a> which contains all the required OSGi bundle manifest headers as well das the JSR-233 <code>ScriptEngine</code> to use the <code>groovy-all.jar</code> unmodified with Sling. So just go ahead, grab the Groovy-All 1.6 RC 1 SNAPSHOT deploy it into your Sling instance and enjoy the fun of Groovy.</p>
+<p>If you want to be on verge of development, you might want to go for Groovy 1.7: The second SNAPSHOT of beta-1 also contains the required headers and classes and may as well be used unmodified in Sling. You may download it here: <code>[groovy-all-1.7-beta-1-20081210.120632-2.jar]()</code>.</p>
+<p>To deploy the bundle go to the Bundles page, for example at http://localhost:8888/system/console/bundles of the Apache Felix Web Console select the bundle file to upload, check the <em>Start</em> check box and click <em>Install or Update</em> button.</p>
+<p>You may check, whether the Groovy ScriptEngine has been "accepted" by Sling, by going to the Script Engines page of the Apache Felix Web Console. You should see the entry for Groovy there, somthing like this:</p>
+<div class="codehilite"><pre><span class="n">Groovy</span> <span class="n">Scripting</span> <span class="n">Engine</span><span class="p">,</span> <span class="mf">2.0</span>
+  <span class="n">Language</span>      <span class="n">Groovy</span><span class="p">,</span>
+  <span class="n">Extensions</span>    <span class="n">groovy</span>
+  <span class="n">MIME</span> <span class="n">Types</span>    <span class="n">application</span><span class="o">/</span><span class="n">x</span><span class="o">-</span><span class="n">groovy</span>
+  <span class="n">Names</span>         <span class="n">groovy</span><span class="p">,</span> <span class="n">Groovy</span>
+</pre></div>
+
+
+<h2 id="testing">Testing</h2>
+<p>To test create a simple Groovy script, for example</p>
+<div class="codehilite"><pre>response.setContentType(&quot;text/plain&quot;);
+response.setCharacterEncoding(&quot;UTF-8&quot;);
+
+println &quot;Hello World !&quot;
+println &quot;This is Groovy Speaking&quot;
+println &quot;You requested the Resource <span class="cp">${</span><span class="n">resource</span><span class="cp">}</span> (yes, this is a GString)&quot;
+</pre></div>
+
+
+<p>and upload it to the repository as <code>/apps/nt/folder/GET.groovy</code> using your favourite WebDAV client or use curl to upload the file (assuming Sling is running on localhost:8888) :</p>
+<div class="codehilite"><pre><span class="nv">$</span> <span class="nv">curl</span> <span class="o">-</span><span class="n">u</span> <span class="n">admin:admin</span> <span class="o">-</span><span class="n">FGET</span><span class="o">.</span><span class="n">groovy</span><span class="o">=</span><span class="nv">@GET</span><span class="o">.</span><span class="n">groovy</span> <span class="o">-</span><span class="n">F</span><span class="o">..</span><span class="sr">/../</span><span class="n">nt</span><span class="sr">/jcr:primaryType=sling:Folder http:host:8888/</span><span class="n">apps</span><span class="sr">/nt/</span><span class="n">folder</span>
+</pre></div>
+
+
+<p>To test it create a <code>/sample</code> <code>nt:Folder</code> node using your favourite WebDAV client or use curl again:</p>
+<div class="codehilite"><pre><span class="nv">$</span> <span class="nv">curl</span> <span class="o">-</span><span class="n">u</span> <span class="n">admin:admin</span> <span class="o">-</span><span class="n">Fjcr:primaryType</span><span class="o">=</span><span class="n">nt:folder</span> <span class="n">http:</span><span class="sr">//</span><span class="n">localhost:8888</span><span class="o">/</span>
+</pre></div>
+
+
+<p>Finally, request the <code>/sample</code> node using your favourite Browser or use curl again:</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:8888</span><span class="o">/</span><span class="n">sample</span>
+<span class="n">Hello</span> <span class="n">World</span> <span class="o">!</span>
+<span class="n">This</span> <span class="n">is</span> <span class="n">Groovy</span> <span class="n">Speaking</span>
+<span class="n">You</span> <span class="n">requested</span> <span class="n">Resource</span> <span class="n">JcrNodeResource</span><span class="p">,</span> <span class="n">type</span><span class="o">=</span><span class="n">nt:folder</span><span class="p">,</span> <span class="n">path</span><span class="o">=/</span><span class="n">sample</span> <span class="p">(</span><span class="n">yes</span><span class="p">,</span> <span class="n">this</span> <span class="n">is</span> <span class="n">a</span> <span class="n">GString</span><span class="p">)</span>
+</pre></div>
+
+
+<h2 id="references">References</h2>
+<ul>
+<li><a href="">SLING-315</a> -- The initial Sling issue proposing the addition of a Groovy ScriptEngine to Sling.</li>
+<li><a href="">Groovy Support in Apache Sling</a> -- A short thread on turning the Groovy <code>groovy-all.jar</code> into an OSGi Bundle.</li>
+<li><a href="">Groovy in Apache Sling</a> -- Thread on adding the <code>DynamicImport-Package</code> header to the Groovy bundle manifest.</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
+      </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>

Added: websites/staging/sling/trunk/content/old-stuff/scriptengineintegration/xslt-processing-pipeline.html
==============================================================================
--- websites/staging/sling/trunk/content/old-stuff/scriptengineintegration/xslt-processing-pipeline.html (added)
+++ websites/staging/sling/trunk/content/old-stuff/scriptengineintegration/xslt-processing-pipeline.html Tue May 22 09:41:22 2012
@@ -0,0 +1,96 @@
+<!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 - XSLT Processing Pipeline</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="/getting-started.html">Getting Started</a> <br />
+<a href="/the-sling-engine.html">The Sling Engine</a> <br />
+<a href="/development.html">Development</a> <br />
+<a href="/bundles.html">Bundles</a> <br />
+<a href="/tutorials-how-tos.html">Tutorials &amp; How-Tos</a> <br />
+<a href="/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="http://sling.apache.org/site/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="/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="/old-stuff.html">Old Stuff</a>&nbsp;&raquo&nbsp;<a href="/old-stuff/scriptengineintegration.html">Integrating Scripting Languages</a>
+      </div>
+      <h1>XSLT Processing Pipeline</h1>
+      
+      <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
+      </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>

Added: websites/staging/sling/trunk/content/old-stuff/servlet-resolution.html
==============================================================================
--- websites/staging/sling/trunk/content/old-stuff/servlet-resolution.html (added)
+++ websites/staging/sling/trunk/content/old-stuff/servlet-resolution.html Tue May 22 09:41:22 2012
@@ -0,0 +1,267 @@
+<!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 - Servlet 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="/getting-started.html">Getting Started</a> <br />
+<a href="/the-sling-engine.html">The Sling Engine</a> <br />
+<a href="/development.html">Development</a> <br />
+<a href="/bundles.html">Bundles</a> <br />
+<a href="/tutorials-how-tos.html">Tutorials &amp; How-Tos</a> <br />
+<a href="/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="http://sling.apache.org/site/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="/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="/old-stuff.html">Old Stuff</a>
+      </div>
+      <h1>Servlet Resolution</h1>
+      <p>{warning:title=Out Of Sync}
+Please note that the description on this page is out of sync with the most recent developments going on as part of implementing issue <a href="">SLING-387</a>. See the links to integration tests at the end of this page for the Current Truth.</p>
+<p>Please see the new <a href="/documentation/the-sling-engine/servlets.html">Servlets</a> page.
+{warning}</p>
+<div class="toc">
+<ul>
+<li><a href="#servlets-are-resources">Servlets are Resources</a><ul>
+<li><a href="#example-registration-by-path">Example: Registration by Path</a></li>
+<li><a href="#example-registration-by-resource-type-etc">Example: Registration by Resource Type etc.</a></li>
+</ul>
+</li>
+<li><a href="#scripts-are-servlets">Scripts are Servlets</a></li>
+<li><a href="#resolution-process">Resolution Process</a></li>
+<li><a href="#default-servlets">Default Servlet(s)</a></li>
+<li><a href="#error-handler-servlets">Error Handler Servlet(s)</a></li>
+<li><a href="#integration-tests">Integration tests</a></li>
+</ul>
+</div>
+<h2 id="servlets-are-resources">Servlets are Resources</h2>
+<p>As explained on the <a href="/documentation/the-sling-engine/resources.html">Resources</a> page, the Resource is the central data abstraction of Sling. In this contexts, Servlets are of course also povided as Resources. As such Servlets may be enumerated by iterating the Resource tree and Servlets may be retrieved through the <code>ResourceResolver</code>.</p>
+<p>To show a Servlet inside the Resource tree, the <code>sling/servlet-resolver</code> project provides a <code>ServletResourceProvider</code> implementing the <code>ResourceProvider</code> interface. For each Servlet registered as an OSGi service with one or more defined service reference properties a <code>ServletResourceProvider</code> instance is registered.</p>
+<p>The following service reference properties are defined for Servlets defined as OSGi services of type <code>javax.servlet.Servlet</code>:</p>
+<table>
+<thead>
+<tr>
+<th>Name</th>
+<th>Description</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><code>sling.servlet.paths</code></td>
+<td>A list of absolute paths under which the servlet is accessible as a Resource. The property value must either be a single String, an array of Strings or a Vector of Strings.</td>
+</tr>
+<tr>
+<td><code>sling.servlet.resourceTypes</code></td>
+<td>The resource type(s) supported by the servlet. The property value must either be a single String, an array of Strings or a Vector of Strings. This property is ignored if the <code>sling.servlet.paths</code> property is set.</td>
+</tr>
+<tr>
+<td><code>sling.servlet.selectors</code></td>
+<td>The request URL selectors supported by the servlet. The selectors must be configured as they would be specified in the URL that is as a list of dot-separated strings such as <em>print.a4</em>. The property value must either be a single String, an array of Strings or a Vector of Strings. This property is ignored if the <code>sling.servlet.paths</code> property is set.</td>
+</tr>
+<tr>
+<td><code>sling.servlet.extensions</code></td>
+<td>The request URL extensions supported by the servlet for GET requests. The property value must either be a single String, an array of Strings or a Vector of Strings. This property is ignored if the <code>sling.servlet.paths</code> property is set.</td>
+</tr>
+<tr>
+<td><code>sling.servlet.methods</code></td>
+<td>The request methods supported by the servlet. The property value must either be a single String, an array of Strings or a Vector of Strings. This property is ignored if the <code>sling.servlet.paths</code> property is set.</td>
+</tr>
+<tr>
+<td><code>sling.servlet.prefix</code></td>
+<td>The absolute prefix to make relative paths absolute. This property is a String and is optional. If it is not set, the actual prefix used is derived from the search path of the <code>ResourceResolver</code> at the time of registration.</td>
+</tr>
+</tbody>
+</table>
+<p>For a Servlet registered as an OSGi service to be used by the Sling Servlet Resolver, the following restrictions apply:</p>
+<ol>
+<li>Either the <code>sling.servlet.paths</code> or the <code>sling.servlet.resourceTypes</code> service reference property must be set. If neither is set, the Servlet service is ignored.</li>
+<li>If the <code>sling.servlet.paths</code> property is set, all other <code>sling.servlet.*</code> properties are ignored.</li>
+<li>Otherwise a Resource provider is registered for the Servlet for each permutation resource types, selectors, extensions and methods.</li>
+</ol>
+<p>Each path to be used for registration -- either from the <code>sling.servlet.paths</code> property or constructed from the other <code>sling.servlet.*</code> properties -- must be absolute. Any relative path is made absolute by prefixing it with a root path. This prefix may be set with the <code>sling.servlet.prefix</code> service registration property. If this property is not set, the first entry in the <code>ResourceResolver</code> search path for the <code>ResourceResolver.getResource(String)</code> method is used as the prefix. If this entry cannot be derived, a simpe slash -- <code>/</code> -- is used as the prefix.</p>
+<h3 id="example-registration-by-path">Example: Registration by Path</h3>
+<div class="codehilite"><pre><span class="n">sling</span><span class="o">.</span><span class="n">servlet</span><span class="o">.</span><span class="n">paths</span> <span class="o">=</span> <span class="p">[</span> <span class="s">&quot;/libs/sling/sample/html&quot;</span><span class="p">,</span> <span class="s">&quot;/libs/sling/sample/txt&quot;</span> <span class="p">]</span>
+<span class="n">sling</span><span class="o">.</span><span class="n">servlet</span><span class="o">.</span><span class="n">resourceTypes</span> <span class="o">=</span> <span class="p">[</span> <span class="s">&quot;sling/unused&quot;</span> <span class="p">]</span>
+<span class="n">sling</span><span class="o">.</span><span class="n">servlet</span><span class="o">.</span><span class="n">selectors</span> <span class="o">=</span> <span class="p">[</span> <span class="s">&quot;img&quot;</span> <span class="p">]</span>
+<span class="n">sling</span><span class="o">.</span><span class="n">servlet</span><span class="o">.</span><span class="n">extensions</span> <span class="o">=</span> <span class="p">[</span> <span class="s">&quot;html&quot;</span><span class="p">,</span> <span class="s">&quot;txt&quot;</span><span class="p">,</span> <span class="s">&quot;json&quot;</span> <span class="p">]</span>
+</pre></div>
+
+
+<p>A Servlet service registered with these properties is registered under the following paths:</p>
+<ul>
+<li><code>/libs/sling/sample/html</code></li>
+<li><code>/libs/sling/sample/txt</code></li>
+</ul>
+<p>The registration properties <code>sling.servlet.resourceTypes</code>, <code>sling.servlet.selectors</code> and <code>sling.servlet.extensions</code> are ignored because the <code>sling.servlet.paths</code> property is set.</p>
+<h3 id="example-registration-by-resource-type-etc">Example: Registration by Resource Type etc.</h3>
+<div class="codehilite"><pre><span class="n">sling</span><span class="o">.</span><span class="n">servlet</span><span class="o">.</span><span class="n">resourceTypes</span> <span class="o">=</span> <span class="p">[</span> <span class="s">&quot;sling/unused&quot;</span> <span class="p">]</span>
+<span class="n">sling</span><span class="o">.</span><span class="n">servlet</span><span class="o">.</span><span class="n">selectors</span> <span class="o">=</span> <span class="p">[</span> <span class="s">&quot;img&quot;</span><span class="p">,</span> <span class="s">&quot;tab&quot;</span> <span class="p">]</span>
+<span class="n">sling</span><span class="o">.</span><span class="n">servlet</span><span class="o">.</span><span class="n">extensions</span> <span class="o">=</span> <span class="p">[</span> <span class="s">&quot;html&quot;</span><span class="p">,</span> <span class="s">&quot;txt&quot;</span><span class="p">,</span> <span class="s">&quot;json&quot;</span> <span class="p">]</span>
+</pre></div>
+
+
+<p>A Servlet service registered with these properties is registered under the following paths:</p>
+<ul>
+<li><code>*prefix*/sling/unused/img/html</code></li>
+<li><code>*prefix*/sling/unused/img/txt</code></li>
+<li><code>*prefix*/sling/unused/img/json</code></li>
+<li><code>*prefix*/sling/unused/tab/html</code></li>
+<li><code>*prefix*/sling/unused/tab/txt</code></li>
+<li><code>*prefix*/sling/unused/tab/json</code></li>
+</ul>
+<p>As explained the script is registered for each permutation of the resource types, selectors and extension. See above For an explanation of how <code>*prefix*</code> is defined.</p>
+<h2 id="scripts-are-servlets">Scripts are Servlets</h2>
+<p>The Sling API defines a <code>SlingScript</code> interface which is used to represent (executable) scripts inside of Sling. This interface is implemented in the <code>scripting/resolver</code> bundle in the <code>DefaultSlingScript</code> class which also implements the <code>javax.servlet.Servlet</code>.</p>
+<p>To further simplify the access to scripts from the Resource tree, the <code>scripting/resolver</code> bundle registers an <code>AdapterFactory</code> to adapt Resources to Scripts and Servlets. In fact the adapter factory returns instances of the <code>DefaultSlingScript</code> class for both Scripts and Servlets.</p>
+<p>This functionality is used by the <code>ServletResolver.resolveServlet</code> implementation in the <code>sling/servlet-resolver</code> bundle: This implementation just looks up any Resource in the resource tree according its lookup algorithm (see below). The first matching Resource adapting to a <code>javax.servlet.Servlet</code> is used for processing the resource.</p>
+<p>So from the perspective of the Servlet resolver, scripts and servlets are handled exactly the same.</p>
+<h2 id="resolution-process">Resolution Process</h2>
+<p>The Servlet Resolution Process four elements of a <code>SlingHttpServletRequest</code>:</p>
+<ol>
+<li>The <em>resource type</em> as retrieved through <code>request.getResource().getResourceType()</code>. Because the resource type may be a node type such as <em>nt:file</em>, the resource type is mangled into a path by replacing any colons contained to forward slashs. Also, any backslashes contained are replaced to forward slashes. This should give a relative path. Of course a resource type may also be set to an absolute path. See below.</li>
+<li>The <em>request selectors</em> as retrieved through <code>request.getRequestPathInfo().getSelectorString()</code>. The selector string is turned into a realtive path by replacing all separating dots by forward slashes. For example the selector string <code>print.a4</code> is  converted into the relative path <code>print/a4</code>.</li>
+<li>The <em>request extension</em> as retrieved through <code>request.getRequestPathInfo().getExtension()</code> if the request method is <em>GET</em> or <em>HEAD</em> and the request extension is not empty.</li>
+<li>The <em>request method name</em> for any request method except <em>GET</em> or <em>HEAD</em> or if the request extension is empty.</li>
+</ol>
+<p>The <em>resource type</em> is used as a (relative) parent path to the Servlet while the <em>request extension</em> or <em>request method</em> is used as the Servlet (base) name. The Servlet is retrieved from the Resource tree by calling the <code>ResourceResolver.getResource(String)</code> method which handles absolute and relative paths correctly by searching realtive paths in the configured search path.</p>
+<p>The pseudo-code for Servlet resolution is as follows:</p>
+<div class="codehilite"><pre><span class="n">Servlet</span> <span class="n">resolveServlet</span><span class="p">(</span><span class="n">SlingHttpServletRequest</span> <span class="n">request</span><span class="p">)</span> <span class="p">{</span>
+
+    <span class="n">String</span> <span class="n">resourceType</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">getResource</span><span class="p">()</span><span class="o">.</span><span class="n">getResourceType</span><span class="p">();</span>
+    <span class="n">resourceType</span> <span class="o">=</span> <span class="n">resourceType</span><span class="o">.</span><span class="n">replaceAll</span><span class="p">(</span><span class="s">&quot;\\:&quot;</span><span class="p">,</span> <span class="s">&quot;/&quot;</span><span class="p">);</span>
+
+    <span class="n">String</span> <span class="n">baseName</span><span class="p">;</span>
+    <span class="k">if</span> <span class="p">((</span><span class="s">&quot;GET&quot;</span><span class="o">.</span><span class="n">equals</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">getMethod</span><span class="p">())</span> <span class="o">||</span> <span class="s">&quot;HEAD&quot;</span><span class="o">.</span><span class="n">equals</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">getMethod</span><span class="p">())</span>
+            <span class="o">&amp;&amp;</span> <span class="n">request</span><span class="o">.</span><span class="n">getRequestPathInfo</span><span class="p">()</span><span class="o">.</span><span class="n">getExtension</span><span class="p">()</span> <span class="o">!=</span> <span class="n">null</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">baseName</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">getRequestPathInfo</span><span class="p">()</span><span class="o">.</span><span class="n">getExtension</span><span class="p">();</span>
+    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+        <span class="n">baseName</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">getMethod</span><span class="p">();</span>
+    <span class="p">}</span>
+
+    <span class="k">if</span> <span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">getRequestPath</span><span class="p">()</span><span class="o">.</span><span class="n">getSelectorString</span><span class="p">()</span> <span class="o">!=</span> <span class="n">null</span><span class="p">)</span> <span class="p">{</span>
+        <span class="n">String</span> <span class="n">selectors</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">getRequestPath</span><span class="p">()</span><span class="o">.</span><span class="n">getSelectorString</span><span class="p">();</span>
+        <span class="n">selectors</span> <span class="o">=</span> <span class="n">selectors</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s">&#39;.&#39;</span><span class="p">,</span> <span class="s">&#39;/&#39;</span><span class="p">);</span>
+        <span class="k">while</span> <span class="p">(</span><span class="n">selectors</span> <span class="o">!=</span> <span class="n">null</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">resourceType</span> <span class="o">+</span> <span class="s">&quot;/&quot;</span> <span class="o">+</span> <span class="n">selectors</span> <span class="o">+</span> <span class="s">&quot;/&quot;</span> <span class="o">+</span> <span class="n">baseName</span><span class="p">;</span>
+            <span class="n">Servlet</span> <span class="n">servlet</span> <span class="o">=</span> <span class="n">findServletFor</span><span class="p">(</span><span class="n">path</span><span class="p">);</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">servlet</span> <span class="o">!=</span> <span class="n">null</span><span class="p">)</span> <span class="p">{</span>
+                <span class="k">return</span> <span class="n">servlet</span><span class="p">;</span>
+            <span class="p">}</span>
+
+            <span class="nb">int</span> <span class="n">lastSlash</span> <span class="o">=</span> <span class="n">selectors</span><span class="o">.</span><span class="n">lastIndexOf</span><span class="p">(</span><span class="s">&#39;/&#39;</span><span class="p">);</span>
+            <span class="k">if</span> <span class="p">(</span><span class="n">lastSlash</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
+                <span class="n">selectors</span> <span class="o">=</span> <span class="n">selectors</span><span class="o">.</span><span class="n">substring</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">lastSlash</span><span class="p">);</span>
+            <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
+                <span class="n">selectors</span> <span class="o">=</span> <span class="n">null</span><span class="p">;</span>
+            <span class="p">}</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">resourceType</span> <span class="o">+</span> <span class="s">&quot;/&quot;</span> <span class="o">+</span> <span class="n">baseName</span><span class="p">;</span>
+    <span class="k">return</span> <span class="n">findScriptFor</span><span class="p">(</span><span class="n">path</span><span class="p">);</span>
+<span class="p">}</span>
+
+<span class="n">Servlet</span> <span class="n">findScriptFor</span><span class="p">(</span><span class="n">path</span><span class="p">)</span> <span class="p">{</span>
+    <span class="sr">//</span> <span class="n">Find</span> <span class="n">a</span> <span class="n">Servlet</span> <span class="ow">or</span> <span class="n">Script</span> <span class="n">with</span> <span class="n">the</span> <span class="n">given</span> <span class="n">path</span> <span class="n">in</span> <span class="n">the</span> <span class="n">search</span> <span class="n">path</span>
+    <span class="sr">//</span> <span class="n">where</span> <span class="n">the</span> <span class="n">Script</span> <span class="n">is</span> <span class="n">allowed</span> <span class="n">to</span> <span class="n">have</span> <span class="n">Script</span> <span class="n">language</span> <span class="n">specific</span>
+    <span class="sr">//</span> <span class="n">extension</span><span class="p">,</span> <span class="n">such</span> <span class="n">as</span> <span class="o">.</span><span class="n">js</span><span class="p">,</span> <span class="o">.</span><span class="n">jsp</span><span class="p">,</span> <span class="n">etc</span><span class="o">.</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<h2 id="default-servlets">Default Servlet(s)</h2>
+<p>As explained in the Resolution Process section above, a default Servlet is selected if no servlet for the current resource type can be found. To make the provisioning of a default Servlet as versatile as provisioning per resource type Servlets (or scripts), the default Servlet is selected with just a special resource type <code>sling/servlet/default</code>.</p>
+<p>The actual Servlet or Script called as the default Servlet is resolved exactly the same way as for any resource type. That is, also for the default Servlet selection, the request selectors and extension or method are considered. Also, the Servlet may be a Servlet registered as an OSGi service and provided through a Servlet Resource provider or it may be a Script stored in the repository or provided by the bundle.</p>
+<p>Finally, if not even a registered default Servlet may be resolved for the request, because none has been registered, the <code>sling/servlet-resolve</code> bundle provides a fall back <code>DefaultServlet</code> with the following functionality:</p>
+<ul>
+<li>If the request has no extension and the Resource of the request adapts to an <code>InputStream</code>, the contents of the resoure is stream out as the response. The response content type is taken from the <code>sling.contentType</code> Resource meta data or derived from the Resource path. If the <code>sling.characterEncoding</code> Resource meta data property is set, that value is used as the response character encoding. Currently there is no ETag and modification time stamp support.</li>
+<li>Otherwise if the object has an OCM mapping, the properties of the mapped object are printed.</li>
+<li>Otherwise just the path of the Resource is printed.</li>
+</ul>
+<h2 id="error-handler-servlets">Error Handler Servlet(s)</h2>
+<p>The <code>sling/servlet-resolver</code> project also provides an implementation of the Sling Core <code>ErrorHandler</code> interface, which applies the same Servlet resolution process as used for normal request processing. Error handler Servlets and Scripts are looked up with the predefined resource <code>sling/servlet/errorhandler</code> and an error specific name:</p>
+<ul>
+<li><em>HTTP Status Code Handling</em>: To handle HTTP status code as used by the <code>HttpServletResponse.sendError</code> methods, status code is used as the Servlet name. For example to provide a handler for status code 404 (NOT<em>FOUND), you could create a script <code>prefix/sling/servlet/errorhandler/404.esp</code> or for a status code 500 (INTERNAL</em>SERVER_ERRROR), you might want to register a Servlet at <code>prefix/sling/servlet/errorhandler/500</code>.</li>
+<li><em>Throwable Handling</em>: To handle uncaught <code>Throwables</code> the simple name of the <code>Throwable</code> class is used as the Servlet name. Similarly to the Java <code>try-catch</code> clauses the class hierarchy is supported. That is to handle an uncaught <code>FileNotFoundException</code>, the names <code>FileNotFoundException</code>, <code>IOException</code>, <code>Exception</code>, <code>Throwable</code> are checked for a Servlet and the first one found is then used. Again, the Serlvet may be a Servlet registered as an OSGi service or may be a plain script stored in the JCR repository or provided through some custom Resource provider.</li>
+</ul>
+<h2 id="integration-tests">Integration tests</h2>
+<p>A set of simple example servlets is available in the <a href="">launchpad/test-services module</a>. </p>
+<p>Integration tests in the <a href="">launchpad/testing module</a> verify that these examples are correct.</p>
+<p>Contributions to these tests and examples are welcome, of course!</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
+      </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