You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2017/06/26 13:37:03 UTC

[03/15] sling-site git commit: Updating ng test site

http://git-wip-us.apache.org/repos/asf/sling-site/blob/5f5c8f10/old-stuff/request-processing.html
----------------------------------------------------------------------
diff --git a/old-stuff/request-processing.html b/old-stuff/request-processing.html
new file mode 100644
index 0000000..a9dfa6d
--- /dev/null
+++ b/old-stuff/request-processing.html
@@ -0,0 +1,183 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html lang="en">
+<head>
+        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+        <title>Apache Sling on JBake</title>
+        <link rel="icon" href="/ng/res/favicon.ico"/>
+        <link rel="stylesheet" href="/ng/res/css/site.css"/>
+        
+    </head>    <body>
+<div class="title">
+            <div class="logo">
+                <a href="http://sling.apache.org">
+                    <img border="0" alt="Apache Sling" src="/ng/res/logos/sling.svg"/>
+                </a>
+            </div><div class="header">
+                <a href="http://www.apache.org">
+                    <img border="0" alt="Apache" src="/ng/res/logos/apache.png"/>
+                </a>
+            </div>
+        </div><h1 class="draft">DRAFT 2017 WEBSITE - SLING-6955</h1><div class="menu">
+            <p>
+                <strong><a href="/ng/documentation.html">Documentation</a></strong><br/>
+                <a href="/ng/documentation/getting-started.html">Getting Started</a><br/>
+                <a href="/ng/documentation/the-sling-engine.html">The Sling Engine</a><br/>
+                <a href="/ng/documentation/development.html">Development</a><br/>
+                <a href="/ng/documentation/bundles.html">Bundles</a><br/>
+                <a href="/ng/documentation/tutorials-how-tos.html">Tutorials &amp; How-Tos</a><br/>
+                <a href="/ng/documentation/configuration.html">Configuration</a>
+            </p><p>
+                <a href="http://s.apache.org/sling.wiki">Wiki</a><br/>
+                <a href="http://s.apache.org/sling.faq">FAQ</a><br/>
+                
+            </p><p>
+                <strong>API Docs</strong><br/>
+                <a href="/ng/apidocs/sling9/index.html">Sling 9</a><br/>
+                <a href="/ng/apidocs/sling8/index.html">Sling 8</a><br/>
+                <a href="/ng/apidocs/sling7/index.html">Sling 7</a><br/>
+                <a href="/ng/apidocs/sling6/index.html">Sling 6</a><br/>
+                <a href="/ng/apidocs/sling5/index.html">Sling 5</a><br/>
+                <a href="/ng/javadoc-io.html">Archive at javadoc.io</a><br/>
+                
+            </p><p>
+                <strong>Project info</strong><br/>
+                <a href="/ng/downloads.cgi">Downloads</a><br/>
+                <a href="http://www.apache.org/licenses/">License</a><br/>
+                <a href="/ng/contributing.html">Contributing</a><br/>
+                <a href="/ng/news.html">News</a><br/>
+                <a href="/ng/links.html">Links</a><br/>
+                <a href="/ng/project-information.html">Project Information</a><br/>
+                <a href="https://issues.apache.org/jira/browse/SLING">Issue Tracker</a><br/>
+                <a href="/ng/project-information/security.html">Security</a><br/>
+                
+            </p><p>
+                <strong>Source</strong><br/>
+                <a href="http://svn.apache.org/viewvc/sling/trunk">Subversion</a><br/>
+                <a href="git://git.apache.org/sling.git">Git</a><br/>
+                <a href="https://github.com/apache/sling">Github Mirror</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="https://donate.apache.org/">Donate!</a><br/>
+                <a href="http://www.apache.org/foundation/buy_stuff.html">Buy Stuff</a><br/>
+                
+            </p><p>
+                <strong><a href="/ng/sitemap.html">Site Map</a></strong>
+            </p>
+        </div>        <div class="main">
+<div class="row"><div class="small-12 columns"><section class="wrap"><header><h1>Request Processing</h1></header><div class="note">
+2008-02-13: this page is *out of sync* with the current codebase, needs to be reviewed and updated.
+</div>
+<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>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>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>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 [Default Content Mapping and Request Rendering]({{ refs.default-mapping-and-rendering.path }}) page.</p>
+<h2>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>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>
+<pre><code>RequestDispatcher rd = request.getRequestDispatcher(&quot;navigation&quot;);
+rd.include(request, response);
+</code></pre>
+<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>
+<pre><code>Content navigation = request.getContent(&quot;navigation&quot;);
+if (navigation != null) {
+    RequestDispatcher rd = request.getRequestDispatcher(navigation);
+    rd.include(request, response);
+}
+</code></pre>
+<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>
+<pre><code>Content navigation = new Content() {
+    public String getPath() {
+        return request.getContent().getPath() + &quot;/navigation&quot;;
+    }
+    public String getComponentId() {
+        return NavigationComponent.getClass().getName();
+    }
+}
+
+RequestDispatcher rd = request.getRequestDispatcher(navigation);
+rd.include(request, response);
+</code></pre>
+<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>
+<pre><code>Content navigation = request.getContent(&quot;navigation&quot;);
+if (navigation == null) {
+    navigation = new Content() {
+        public String getPath() {
+            return request.getContent().getPath() + &quot;/navigation&quot;;
+        }
+        public String getComponentId() {
+            return NavigationComponent.getClass().getName();
+        }
+    }
+}
+
+RequestDispatcher rd = request.getRequestDispatcher(navigation);
+rd.include(request, response);
+</code></pre>
+<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></section></div></div>            
+<div class="footer">
+                <div class="timestamp">
+                    TODO display revision number here
+                </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>            
+            
+        </div>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/sling-site/blob/5f5c8f10/old-stuff/run-modes-org-apache-sling-runmode.html
----------------------------------------------------------------------
diff --git a/old-stuff/run-modes-org-apache-sling-runmode.html b/old-stuff/run-modes-org-apache-sling-runmode.html
new file mode 100644
index 0000000..3322c7f
--- /dev/null
+++ b/old-stuff/run-modes-org-apache-sling-runmode.html
@@ -0,0 +1,109 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html lang="en">
+<head>
+        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+        <title>Apache Sling on JBake</title>
+        <link rel="icon" href="/ng/res/favicon.ico"/>
+        <link rel="stylesheet" href="/ng/res/css/site.css"/>
+        
+    </head>    <body>
+<div class="title">
+            <div class="logo">
+                <a href="http://sling.apache.org">
+                    <img border="0" alt="Apache Sling" src="/ng/res/logos/sling.svg"/>
+                </a>
+            </div><div class="header">
+                <a href="http://www.apache.org">
+                    <img border="0" alt="Apache" src="/ng/res/logos/apache.png"/>
+                </a>
+            </div>
+        </div><h1 class="draft">DRAFT 2017 WEBSITE - SLING-6955</h1><div class="menu">
+            <p>
+                <strong><a href="/ng/documentation.html">Documentation</a></strong><br/>
+                <a href="/ng/documentation/getting-started.html">Getting Started</a><br/>
+                <a href="/ng/documentation/the-sling-engine.html">The Sling Engine</a><br/>
+                <a href="/ng/documentation/development.html">Development</a><br/>
+                <a href="/ng/documentation/bundles.html">Bundles</a><br/>
+                <a href="/ng/documentation/tutorials-how-tos.html">Tutorials &amp; How-Tos</a><br/>
+                <a href="/ng/documentation/configuration.html">Configuration</a>
+            </p><p>
+                <a href="http://s.apache.org/sling.wiki">Wiki</a><br/>
+                <a href="http://s.apache.org/sling.faq">FAQ</a><br/>
+                
+            </p><p>
+                <strong>API Docs</strong><br/>
+                <a href="/ng/apidocs/sling9/index.html">Sling 9</a><br/>
+                <a href="/ng/apidocs/sling8/index.html">Sling 8</a><br/>
+                <a href="/ng/apidocs/sling7/index.html">Sling 7</a><br/>
+                <a href="/ng/apidocs/sling6/index.html">Sling 6</a><br/>
+                <a href="/ng/apidocs/sling5/index.html">Sling 5</a><br/>
+                <a href="/ng/javadoc-io.html">Archive at javadoc.io</a><br/>
+                
+            </p><p>
+                <strong>Project info</strong><br/>
+                <a href="/ng/downloads.cgi">Downloads</a><br/>
+                <a href="http://www.apache.org/licenses/">License</a><br/>
+                <a href="/ng/contributing.html">Contributing</a><br/>
+                <a href="/ng/news.html">News</a><br/>
+                <a href="/ng/links.html">Links</a><br/>
+                <a href="/ng/project-information.html">Project Information</a><br/>
+                <a href="https://issues.apache.org/jira/browse/SLING">Issue Tracker</a><br/>
+                <a href="/ng/project-information/security.html">Security</a><br/>
+                
+            </p><p>
+                <strong>Source</strong><br/>
+                <a href="http://svn.apache.org/viewvc/sling/trunk">Subversion</a><br/>
+                <a href="git://git.apache.org/sling.git">Git</a><br/>
+                <a href="https://github.com/apache/sling">Github Mirror</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="https://donate.apache.org/">Donate!</a><br/>
+                <a href="http://www.apache.org/foundation/buy_stuff.html">Buy Stuff</a><br/>
+                
+            </p><p>
+                <strong><a href="/ng/sitemap.html">Site Map</a></strong>
+            </p>
+        </div>        <div class="main">
+<div class="row"><div class="small-12 columns"><section class="wrap"><header><h1>Run Modes</h1></header><div markdown="1" class="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 Bundle, though.
+</div>
+<h1>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>[org.apache.sling.runmode]({{ refs.http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/runmode.path }})</em> bundle provides a simple way of defining and querying a list of run modes.</p>
+<h1>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>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 (*sling.run.modes=dev,staging*) that might be present in the <em>sling.properties</em> file found in the Sling home directory.</p>
+<h1>Getting the current list of run modes</h1>
+<p>The [RunMode service]({{ refs.http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/runmode/src/main/java/org/apache/sling/runmode/RunMode.java.path }}) provides the current list of run modes, examples:</p>
+<pre><code>:::java
+RunMode r = ...get from BundleContext...
+String [] currentRunModes = r.getCurrentRunModes();
+
+String [] expectedRunModes = { &quot;foo&quot;, &quot;wii&quot; };
+if(r.isActive(expectedRunModes)) {
+  // at least one of (foo,wii) run modes
+  // is active
+}
+</code></pre>
+<h1>See also</h1>
+<p>The RunMode service is used by the [jcrinstall]({{ refs.jcr-installer-provider.path }}) services.</p></section></div></div>            
+<div class="footer">
+                <div class="timestamp">
+                    TODO display revision number here
+                </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>            
+            
+        </div>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/sling-site/blob/5f5c8f10/old-stuff/scriptengineintegration.html
----------------------------------------------------------------------
diff --git a/old-stuff/scriptengineintegration.html b/old-stuff/scriptengineintegration.html
new file mode 100644
index 0000000..dc6c8fd
--- /dev/null
+++ b/old-stuff/scriptengineintegration.html
@@ -0,0 +1,90 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html lang="en">
+<head>
+        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+        <title>Apache Sling on JBake</title>
+        <link rel="icon" href="/ng/res/favicon.ico"/>
+        <link rel="stylesheet" href="/ng/res/css/site.css"/>
+        
+    </head>    <body>
+<div class="title">
+            <div class="logo">
+                <a href="http://sling.apache.org">
+                    <img border="0" alt="Apache Sling" src="/ng/res/logos/sling.svg"/>
+                </a>
+            </div><div class="header">
+                <a href="http://www.apache.org">
+                    <img border="0" alt="Apache" src="/ng/res/logos/apache.png"/>
+                </a>
+            </div>
+        </div><h1 class="draft">DRAFT 2017 WEBSITE - SLING-6955</h1><div class="menu">
+            <p>
+                <strong><a href="/ng/documentation.html">Documentation</a></strong><br/>
+                <a href="/ng/documentation/getting-started.html">Getting Started</a><br/>
+                <a href="/ng/documentation/the-sling-engine.html">The Sling Engine</a><br/>
+                <a href="/ng/documentation/development.html">Development</a><br/>
+                <a href="/ng/documentation/bundles.html">Bundles</a><br/>
+                <a href="/ng/documentation/tutorials-how-tos.html">Tutorials &amp; How-Tos</a><br/>
+                <a href="/ng/documentation/configuration.html">Configuration</a>
+            </p><p>
+                <a href="http://s.apache.org/sling.wiki">Wiki</a><br/>
+                <a href="http://s.apache.org/sling.faq">FAQ</a><br/>
+                
+            </p><p>
+                <strong>API Docs</strong><br/>
+                <a href="/ng/apidocs/sling9/index.html">Sling 9</a><br/>
+                <a href="/ng/apidocs/sling8/index.html">Sling 8</a><br/>
+                <a href="/ng/apidocs/sling7/index.html">Sling 7</a><br/>
+                <a href="/ng/apidocs/sling6/index.html">Sling 6</a><br/>
+                <a href="/ng/apidocs/sling5/index.html">Sling 5</a><br/>
+                <a href="/ng/javadoc-io.html">Archive at javadoc.io</a><br/>
+                
+            </p><p>
+                <strong>Project info</strong><br/>
+                <a href="/ng/downloads.cgi">Downloads</a><br/>
+                <a href="http://www.apache.org/licenses/">License</a><br/>
+                <a href="/ng/contributing.html">Contributing</a><br/>
+                <a href="/ng/news.html">News</a><br/>
+                <a href="/ng/links.html">Links</a><br/>
+                <a href="/ng/project-information.html">Project Information</a><br/>
+                <a href="https://issues.apache.org/jira/browse/SLING">Issue Tracker</a><br/>
+                <a href="/ng/project-information/security.html">Security</a><br/>
+                
+            </p><p>
+                <strong>Source</strong><br/>
+                <a href="http://svn.apache.org/viewvc/sling/trunk">Subversion</a><br/>
+                <a href="git://git.apache.org/sling.git">Git</a><br/>
+                <a href="https://github.com/apache/sling">Github Mirror</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="https://donate.apache.org/">Donate!</a><br/>
+                <a href="http://www.apache.org/foundation/buy_stuff.html">Buy Stuff</a><br/>
+                
+            </p><p>
+                <strong><a href="/ng/sitemap.html">Site Map</a></strong>
+            </p>
+        </div>        <div class="main">
+<div class="row"><div class="small-12 columns"><section class="wrap"><header><h1>Integrating Scripting Languages</h1></header><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:
+    <ul>
+      <li>Create the ScriptEngineFactory implementation</li>
+      <li>Create a bundle comprising the above implementation as well as the script language implementation.</li>
+      <li>Create the <code>META-INF/services/javax.script.ScriptEngineFactory</code> file listing the fully qualified name of your ScriptEngineFactory implementaiton</li>
+    </ul>
+  </li>
+</ul></section></div></div>            
+<div class="footer">
+                <div class="timestamp">
+                    TODO display revision number here
+                </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>            
+            
+        </div>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/sling-site/blob/5f5c8f10/old-stuff/scriptengineintegration/groovy-support.html
----------------------------------------------------------------------
diff --git a/old-stuff/scriptengineintegration/groovy-support.html b/old-stuff/scriptengineintegration/groovy-support.html
new file mode 100644
index 0000000..4d15136
--- /dev/null
+++ b/old-stuff/scriptengineintegration/groovy-support.html
@@ -0,0 +1,118 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html lang="en">
+<head>
+        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+        <title>Apache Sling on JBake</title>
+        <link rel="icon" href="/ng/res/favicon.ico"/>
+        <link rel="stylesheet" href="/ng/res/css/site.css"/>
+        
+    </head>    <body>
+<div class="title">
+            <div class="logo">
+                <a href="http://sling.apache.org">
+                    <img border="0" alt="Apache Sling" src="/ng/res/logos/sling.svg"/>
+                </a>
+            </div><div class="header">
+                <a href="http://www.apache.org">
+                    <img border="0" alt="Apache" src="/ng/res/logos/apache.png"/>
+                </a>
+            </div>
+        </div><h1 class="draft">DRAFT 2017 WEBSITE - SLING-6955</h1><div class="menu">
+            <p>
+                <strong><a href="/ng/documentation.html">Documentation</a></strong><br/>
+                <a href="/ng/documentation/getting-started.html">Getting Started</a><br/>
+                <a href="/ng/documentation/the-sling-engine.html">The Sling Engine</a><br/>
+                <a href="/ng/documentation/development.html">Development</a><br/>
+                <a href="/ng/documentation/bundles.html">Bundles</a><br/>
+                <a href="/ng/documentation/tutorials-how-tos.html">Tutorials &amp; How-Tos</a><br/>
+                <a href="/ng/documentation/configuration.html">Configuration</a>
+            </p><p>
+                <a href="http://s.apache.org/sling.wiki">Wiki</a><br/>
+                <a href="http://s.apache.org/sling.faq">FAQ</a><br/>
+                
+            </p><p>
+                <strong>API Docs</strong><br/>
+                <a href="/ng/apidocs/sling9/index.html">Sling 9</a><br/>
+                <a href="/ng/apidocs/sling8/index.html">Sling 8</a><br/>
+                <a href="/ng/apidocs/sling7/index.html">Sling 7</a><br/>
+                <a href="/ng/apidocs/sling6/index.html">Sling 6</a><br/>
+                <a href="/ng/apidocs/sling5/index.html">Sling 5</a><br/>
+                <a href="/ng/javadoc-io.html">Archive at javadoc.io</a><br/>
+                
+            </p><p>
+                <strong>Project info</strong><br/>
+                <a href="/ng/downloads.cgi">Downloads</a><br/>
+                <a href="http://www.apache.org/licenses/">License</a><br/>
+                <a href="/ng/contributing.html">Contributing</a><br/>
+                <a href="/ng/news.html">News</a><br/>
+                <a href="/ng/links.html">Links</a><br/>
+                <a href="/ng/project-information.html">Project Information</a><br/>
+                <a href="https://issues.apache.org/jira/browse/SLING">Issue Tracker</a><br/>
+                <a href="/ng/project-information/security.html">Security</a><br/>
+                
+            </p><p>
+                <strong>Source</strong><br/>
+                <a href="http://svn.apache.org/viewvc/sling/trunk">Subversion</a><br/>
+                <a href="git://git.apache.org/sling.git">Git</a><br/>
+                <a href="https://github.com/apache/sling">Github Mirror</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="https://donate.apache.org/">Donate!</a><br/>
+                <a href="http://www.apache.org/foundation/buy_stuff.html">Buy Stuff</a><br/>
+                
+            </p><p>
+                <strong><a href="/ng/sitemap.html">Site Map</a></strong>
+            </p>
+        </div>        <div class="main">
+<div class="row"><div class="small-12 columns"><section class="wrap"><header><h1>Groovy Support</h1></header><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 [first RC1 Snapshot of Groovy 1.6]({{ refs.http://snapshots.repository.codehaus.org/org/codehaus/groovy/groovy-all/1.6-RC-1-SNAPSHOT/groovy-all-1.6-RC-1-20081211.113737-1.jar.path }}) 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]({{ refs.http://snapshots.repository.codehaus.org/org/codehaus/groovy/groovy-all/1.7-beta-1-SNAPSHOT/groovy-all-1.7-beta-1-20081210.120632-2.jar.path }})</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>
+<pre><code>Groovy Scripting Engine, 2.0
+  Language      Groovy,
+  Extensions    groovy
+  MIME Types    application/x-groovy
+  Names         groovy, Groovy
+</code></pre>
+<h2>Testing</h2>
+<p>To test create a simple Groovy script, for example</p>
+<pre><code>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 ${resource} (yes, this is a GString)&quot;
+</code></pre>
+<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>
+<pre><code>$ curl -u admin:admin -FGET.groovy=@GET.groovy -F../../nt/jcr:primaryType=sling:Folder http:host:8888/apps/nt/folder
+</code></pre>
+<p>To test it create a <code>/sample</code> <code>nt:Folder</code> node using your favourite WebDAV client or use curl again:</p>
+<pre><code>$ curl -u admin:admin -Fjcr:primaryType=nt:folder http://localhost:8888/
+</code></pre>
+<p>Finally, request the <code>/sample</code> node using your favourite Browser or use curl again:</p>
+<pre><code>$ curl http://localhost:8888/sample
+Hello World !
+This is Groovy Speaking
+You requested Resource JcrNodeResource, type=nt:folder, path=/sample (yes, this is a GString)
+</code></pre>
+<h2>References</h2>
+<ul>
+  <li>[SLING-315]({{ refs.https://issues.apache.org/jira/browse/SLING-315.path }}) -- The initial Sling issue proposing the addition of a Groovy ScriptEngine to Sling.</li>
+  <li>[Groovy Support in Apache Sling]({{ refs.http://markmail.org/message/7sqscr5y2mbk6jko.path }}) -- A short thread on turning the Groovy <code>groovy-all.jar</code> into an OSGi Bundle.</li>
+  <li>[Groovy in Apache Sling]({{ refs.http://markmail.org/message/47n2ow2jlo553jvk.path }}) -- Thread on adding the <code>DynamicImport-Package</code> header to the Groovy bundle manifest.</li>
+</ul></section></div></div>            
+<div class="footer">
+                <div class="timestamp">
+                    TODO display revision number here
+                </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>            
+            
+        </div>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/sling-site/blob/5f5c8f10/old-stuff/scriptengineintegration/xslt-processing-pipeline.html
----------------------------------------------------------------------
diff --git a/old-stuff/scriptengineintegration/xslt-processing-pipeline.html b/old-stuff/scriptengineintegration/xslt-processing-pipeline.html
new file mode 100644
index 0000000..eb423ff
--- /dev/null
+++ b/old-stuff/scriptengineintegration/xslt-processing-pipeline.html
@@ -0,0 +1,245 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html lang="en">
+<head>
+        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+        <title>Apache Sling on JBake</title>
+        <link rel="icon" href="/ng/res/favicon.ico"/>
+        <link rel="stylesheet" href="/ng/res/css/site.css"/>
+        
+    </head>    <body>
+<div class="title">
+            <div class="logo">
+                <a href="http://sling.apache.org">
+                    <img border="0" alt="Apache Sling" src="/ng/res/logos/sling.svg"/>
+                </a>
+            </div><div class="header">
+                <a href="http://www.apache.org">
+                    <img border="0" alt="Apache" src="/ng/res/logos/apache.png"/>
+                </a>
+            </div>
+        </div><h1 class="draft">DRAFT 2017 WEBSITE - SLING-6955</h1><div class="menu">
+            <p>
+                <strong><a href="/ng/documentation.html">Documentation</a></strong><br/>
+                <a href="/ng/documentation/getting-started.html">Getting Started</a><br/>
+                <a href="/ng/documentation/the-sling-engine.html">The Sling Engine</a><br/>
+                <a href="/ng/documentation/development.html">Development</a><br/>
+                <a href="/ng/documentation/bundles.html">Bundles</a><br/>
+                <a href="/ng/documentation/tutorials-how-tos.html">Tutorials &amp; How-Tos</a><br/>
+                <a href="/ng/documentation/configuration.html">Configuration</a>
+            </p><p>
+                <a href="http://s.apache.org/sling.wiki">Wiki</a><br/>
+                <a href="http://s.apache.org/sling.faq">FAQ</a><br/>
+                
+            </p><p>
+                <strong>API Docs</strong><br/>
+                <a href="/ng/apidocs/sling9/index.html">Sling 9</a><br/>
+                <a href="/ng/apidocs/sling8/index.html">Sling 8</a><br/>
+                <a href="/ng/apidocs/sling7/index.html">Sling 7</a><br/>
+                <a href="/ng/apidocs/sling6/index.html">Sling 6</a><br/>
+                <a href="/ng/apidocs/sling5/index.html">Sling 5</a><br/>
+                <a href="/ng/javadoc-io.html">Archive at javadoc.io</a><br/>
+                
+            </p><p>
+                <strong>Project info</strong><br/>
+                <a href="/ng/downloads.cgi">Downloads</a><br/>
+                <a href="http://www.apache.org/licenses/">License</a><br/>
+                <a href="/ng/contributing.html">Contributing</a><br/>
+                <a href="/ng/news.html">News</a><br/>
+                <a href="/ng/links.html">Links</a><br/>
+                <a href="/ng/project-information.html">Project Information</a><br/>
+                <a href="https://issues.apache.org/jira/browse/SLING">Issue Tracker</a><br/>
+                <a href="/ng/project-information/security.html">Security</a><br/>
+                
+            </p><p>
+                <strong>Source</strong><br/>
+                <a href="http://svn.apache.org/viewvc/sling/trunk">Subversion</a><br/>
+                <a href="git://git.apache.org/sling.git">Git</a><br/>
+                <a href="https://github.com/apache/sling">Github Mirror</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="https://donate.apache.org/">Donate!</a><br/>
+                <a href="http://www.apache.org/foundation/buy_stuff.html">Buy Stuff</a><br/>
+                
+            </p><p>
+                <strong><a href="/ng/sitemap.html">Site Map</a></strong>
+            </p>
+        </div>        <div class="main">
+<div class="row"><div class="small-12 columns"><section class="wrap"><header><h1>XSLT Processing Pipeline</h1></header><p>In the <em>Apache Sling Scripting W3C XML Processing Support</em> bundle, Juanjo Vàzquez has implemented XSLT processing support for Sling as another new scripting engine, based on the <a href="http://cocoon.apache.org/3.0/">Cocoon 3 pipeline engine</a>.</p>
+<h2>Intro</h2>
+<p>An XML pipeline specifies a sequence of operations to be performed on zero or more XML documents. There are a number of advantages to using pipelines above all in terms of separation of concerns. On the other hand, we talk about XSLT processing if the operations in a pipeline are performed executing or applying XSLT stylesheets.</p>
+<p>XSLT processing support is implemented in Sling as an scripting engine bundle named <em>Apache Sling Scripting W3C XML Processing Support</em>. This bundle is based on the <a href="http://cocoon.apache.org/3.0/">Cocoon 3 pipeline engine</a> and uses the <a href="http://www.w3.org/TR/xproc/">W3C XProc language</a> in order to specify pipelines to be processed.</p>
+<p>For the time being, XProc is partially implemented and it is not clear that Sling must support all W3C recomendation yet. This could depend of concrete user requirements or use cases.</p>
+<p>The source code is found in the <a href="http://svn.apache.org/repos/asf/incubator/sling/trunk/contrib/scripting/xproc">contrib/scripting/xproc</a> module.</p>
+<h2>How to Install</h2>
+<p>Install the <code>org.apache.sling.scripting.xproc</code> bundle in order to work with XProc. You can achieve this either building it from <code>contrib/scripting/xproc</code> folder in the Sling trunk or by downloading it from the Apache Snapshot repository here: <a href="http://people.apache.org/repo/m2-snapshot-repository/org/apache/sling/org.apache.sling.scripting.xproc/2.0.0-incubator-SNAPSHOT/org.apache.sling.scripting.xproc-2.0.0-incubator-20090403.114403-1.jar">org.apache.sling.scripting.xproc-2.0.0-incubator-20090403.114403-1.jar</a>.</p>
+<p>To deploy the bundle go to the bundles page of Apache Felix Web Console (http://localhost:8888/system/console/bundles), select the bundle file to upload, check the Start check box and click Install or Update button.</p>
+<p>In order to check whether XProc scripting engine has been installed, go to the Script Engines page of the Apache Felix Web Console and see the entry for XProc there:</p>
+<pre><code>Apache Sling Scripting W3C XML Processing Support, 2.0.0-incubator-SNAPSHOT
+    Language     XMLProc, 1.0
+    Extensions   xpl
+    MIME Types   application/xml
+    Names    XProc, xml processing, xml pipeline processor 
+</code></pre>
+<h2>How it works</h2>
+<p>As explained above, the bundle is able to perform a sequence of XSLT transforms on an XML document just as is expressed in a pipeline definition. A pipeline definition is a file with an xpl extension that follows the <a href="http://www.w3.org/TR/xproc/">W3C XProc grammar</a>. Only <code>p:xslt</code> steps are supported at the moment.</p>
+<p>For the XML input of pipeline, the processing uses a Cocoon generator named <code>SlingGenerator</code> that tries to resolve the requested resource as (in order of preference):</p>
+<ul>
+  <li>a static XML file</li>
+  <li>a dynamically generated XML</li>
+  <li>the underlying node's export document view</li>
+</ul>
+<h2>Samples</h2>
+<p>Let's see some samples in order to understand the processing behaviour.</p>
+<ol>
+  <li>
+    <p>Create some content</p>
+    <pre><code>#!bash
+$ curl -u admin:admin -F sling:resourceType=xproc -F title=&quot;some title&quot; \
+-F text=&quot;And some text&quot; http://localhost:8888/foo
+</code></pre>
+  </li>
+  <li>
+    <p>Use WebDAV or curl to create a pipeline script at <code>/apps/xproc/xproc.xpl</code> :</p>
+    <pre><code>#!xml
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;p:pipeline xmlns:p=&quot;http://www.w3.org/ns/xproc&quot;&gt;
+
+  &lt;p:xslt&gt;
+    &lt;p:input port=&quot;stylesheet&quot;&gt;
+      &lt;p:document href=&quot;/apps/xproc/one.xsl&quot;/&gt;
+    &lt;/p:input&gt;
+  &lt;/p:xslt&gt;
+
+  &lt;p:xslt&gt;
+    &lt;p:input port=&quot;stylesheet&quot;&gt;
+      &lt;p:document href=&quot;/apps/xproc/two.xsl&quot;/&gt;
+    &lt;/p:input&gt;
+  &lt;/p:xslt&gt;
+
+&lt;/p:pipeline&gt;
+</code></pre>
+  </li>
+  <li>
+    <p>Store the XSLT transforms in the repository:</p>
+    <p><strong><code>/apps/xproc/one.xsl</code></strong></p>
+    <pre><code>#!xml
+&lt;xsl:stylesheet version=&quot;1.0&quot;
+    xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;
+
+    &lt;xsl:template match=&quot;/&quot;&gt;
+      &lt;one&gt;
+        &lt;xsl:copy-of select=&quot;.&quot;/&gt;
+      &lt;/one&gt;
+    &lt;/xsl:template&gt;
+
+&lt;/xsl:stylesheet&gt;
+</code></pre>
+    <p><strong><code>/apps/xproc/two.xsl</code></strong></p>
+    <pre><code>#!xml
+&lt;xsl:stylesheet version=&quot;1.0&quot;
+    xmlns:xsl=&quot;http://www.w3.org/1999/XSL/Transform&quot;&gt;
+
+    &lt;xsl:template match=&quot;/&quot;&gt;
+      &lt;two&gt;
+        &lt;xsl:copy-of select=&quot;.&quot;/&gt;
+      &lt;/two&gt;
+    &lt;/xsl:template&gt;
+
+&lt;/xsl:stylesheet&gt;
+</code></pre>
+  </li>
+  <li>
+    <p>Request foo.html to execute the pipeline:</p>
+    <pre><code>#!bash
+$ curl http://admin:admin@localhost:8888/foo.html
+
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;two&gt;
+  &lt;one&gt;
+    &lt;foo ...sling:resourceType=&quot;xproc&quot; text=&quot;And some text&quot; title=&quot;some title&quot;/&gt;
+  &lt;/one&gt;
+&lt;/two&gt;
+</code></pre>
+    <p>In this case, the node's document view has been the pipeline's source.</p>
+  </li>
+  <li>
+    <p>Now, store a static XML in the repository at <code>/foo.xml</code>:</p>
+    <pre><code>#!xml
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;foo&gt;
+    &lt;content&gt;
+       foo: static content
+    &lt;/content&gt;
+&lt;/foo&gt;
+</code></pre>
+  </li>
+  <li>
+    <p>Again, request foo.html to execute the pipeline:</p>
+    <pre><code>#!bash
+$ curl http://admin:admin@localhost:8888/foo.html
+
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;two&gt;
+  &lt;one&gt;
+    &lt;foo&gt;
+        &lt;content&gt;
+          foo: static content
+        &lt;/content&gt;
+    &lt;/foo&gt;
+  &lt;/one&gt;
+&lt;/two&gt;
+</code></pre>
+    <p>This time the pipeline's source has been a static XML file.</p>
+  </li>
+  <li>
+    <p>Store a script in the repository at <code>/apps/xproc/xproc.xml.esp</code></p>
+    <pre><code>#!xml
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;foo&gt;
+    &lt;content&gt;
+       foo: dynamic content
+    &lt;/content&gt;
+&lt;/foo&gt;
+</code></pre>
+  </li>
+  <li>
+  <p>Delete the previously created static xml file <code>/foo.xml</code>.</p></li>
+  <li>
+    <p>Request foo.html to execute the pipeline:</p>
+    <pre><code>#!bash
+$ curl http://admin:admin@localhost:8888/foo.html
+
+&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
+&lt;two&gt;
+  &lt;one&gt;
+    &lt;foo&gt;
+        &lt;content&gt;
+          foo: dynamic content
+        &lt;/content&gt;
+    &lt;/foo&gt;
+  &lt;/one&gt;
+&lt;/two&gt;
+</code></pre>
+    <p>This time the pipeline's source has been a dinamically generated XML.</p>
+  </li>
+</ol>
+<h2>References</h2>
+<ul>
+  <li><a href="http://cocoon.apache.org//3.0/">Cocoon 3 pipeline engine</a></li>
+  <li><a href="http://www.w3.org/TR/xproc/">W3C XProc language</a></li>
+  <li><a href="https://issues.apache.org/jira/browse/SLING-893">SLING-893</a></li>
+  <li><a href="http://markmail.org/thread/33h5nhk5e3mswrue">Mail list discussion</a></li>
+</ul></section></div></div>            
+<div class="footer">
+                <div class="timestamp">
+                    TODO display revision number here
+                </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>            
+            
+        </div>
+    </body>
+</html>

http://git-wip-us.apache.org/repos/asf/sling-site/blob/5f5c8f10/old-stuff/servlet-resolution.html
----------------------------------------------------------------------
diff --git a/old-stuff/servlet-resolution.html b/old-stuff/servlet-resolution.html
new file mode 100644
index 0000000..a2ae6a7
--- /dev/null
+++ b/old-stuff/servlet-resolution.html
@@ -0,0 +1,233 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html lang="en">
+<head>
+        <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
+        <title>Apache Sling on JBake</title>
+        <link rel="icon" href="/ng/res/favicon.ico"/>
+        <link rel="stylesheet" href="/ng/res/css/site.css"/>
+        
+    </head>    <body>
+<div class="title">
+            <div class="logo">
+                <a href="http://sling.apache.org">
+                    <img border="0" alt="Apache Sling" src="/ng/res/logos/sling.svg"/>
+                </a>
+            </div><div class="header">
+                <a href="http://www.apache.org">
+                    <img border="0" alt="Apache" src="/ng/res/logos/apache.png"/>
+                </a>
+            </div>
+        </div><h1 class="draft">DRAFT 2017 WEBSITE - SLING-6955</h1><div class="menu">
+            <p>
+                <strong><a href="/ng/documentation.html">Documentation</a></strong><br/>
+                <a href="/ng/documentation/getting-started.html">Getting Started</a><br/>
+                <a href="/ng/documentation/the-sling-engine.html">The Sling Engine</a><br/>
+                <a href="/ng/documentation/development.html">Development</a><br/>
+                <a href="/ng/documentation/bundles.html">Bundles</a><br/>
+                <a href="/ng/documentation/tutorials-how-tos.html">Tutorials &amp; How-Tos</a><br/>
+                <a href="/ng/documentation/configuration.html">Configuration</a>
+            </p><p>
+                <a href="http://s.apache.org/sling.wiki">Wiki</a><br/>
+                <a href="http://s.apache.org/sling.faq">FAQ</a><br/>
+                
+            </p><p>
+                <strong>API Docs</strong><br/>
+                <a href="/ng/apidocs/sling9/index.html">Sling 9</a><br/>
+                <a href="/ng/apidocs/sling8/index.html">Sling 8</a><br/>
+                <a href="/ng/apidocs/sling7/index.html">Sling 7</a><br/>
+                <a href="/ng/apidocs/sling6/index.html">Sling 6</a><br/>
+                <a href="/ng/apidocs/sling5/index.html">Sling 5</a><br/>
+                <a href="/ng/javadoc-io.html">Archive at javadoc.io</a><br/>
+                
+            </p><p>
+                <strong>Project info</strong><br/>
+                <a href="/ng/downloads.cgi">Downloads</a><br/>
+                <a href="http://www.apache.org/licenses/">License</a><br/>
+                <a href="/ng/contributing.html">Contributing</a><br/>
+                <a href="/ng/news.html">News</a><br/>
+                <a href="/ng/links.html">Links</a><br/>
+                <a href="/ng/project-information.html">Project Information</a><br/>
+                <a href="https://issues.apache.org/jira/browse/SLING">Issue Tracker</a><br/>
+                <a href="/ng/project-information/security.html">Security</a><br/>
+                
+            </p><p>
+                <strong>Source</strong><br/>
+                <a href="http://svn.apache.org/viewvc/sling/trunk">Subversion</a><br/>
+                <a href="git://git.apache.org/sling.git">Git</a><br/>
+                <a href="https://github.com/apache/sling">Github Mirror</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="https://donate.apache.org/">Donate!</a><br/>
+                <a href="http://www.apache.org/foundation/buy_stuff.html">Buy Stuff</a><br/>
+                
+            </p><p>
+                <strong><a href="/ng/sitemap.html">Site Map</a></strong>
+            </p>
+        </div>        <div class="main">
+<div class="row"><div class="small-12 columns"><section class="wrap"><header><h1>Servlet Resolution</h1></header><div class="warning">
+Please note that the description on this page is out of sync with the most recent developments going on as part of implementing issue [SLING-387]({{ refs.https://issues.apache.org/jira/browse/SLING-387.path }}). See the links to integration tests at the end of this page for the Current Truth.
+
+Please see the new [Servlets]({{ refs.servlets.path }}) page.
+</div>
+<p>[TOC]</p>
+<h2>Servlets are Resources</h2>
+<p>As explained on the [Resources]({{ refs.resources.path }}) 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>Example: Registration by Path</h3>
+<pre><code>sling.servlet.paths = [ &quot;/libs/sling/sample/html&quot;, &quot;/libs/sling/sample/txt&quot; ]
+sling.servlet.resourceTypes = [ &quot;sling/unused&quot; ]
+sling.servlet.selectors = [ &quot;img&quot; ]
+sling.servlet.extensions = [ &quot;html&quot;, &quot;txt&quot;, &quot;json&quot; ]
+</code></pre>
+<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>Example: Registration by Resource Type etc.</h3>
+<pre><code>sling.servlet.resourceTypes = [ &quot;sling/unused&quot; ]
+sling.servlet.selectors = [ &quot;img&quot;, &quot;tab&quot; ]
+sling.servlet.extensions = [ &quot;html&quot;, &quot;txt&quot;, &quot;json&quot; ]
+</code></pre>
+<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>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>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>
+<pre><code>Servlet resolveServlet(SlingHttpServletRequest request) {
+
+    String resourceType = request.getResource().getResourceType();
+    resourceType = resourceType.replaceAll(&quot;\\:&quot;, &quot;/&quot;);
+
+    String baseName;
+    if ((&quot;GET&quot;.equals(request.getMethod()) || &quot;HEAD&quot;.equals(request.getMethod())
+            &amp;&amp; request.getRequestPathInfo().getExtension() != null) {
+        baseName = request.getRequestPathInfo().getExtension();
+    } else {
+        baseName = request.getMethod();
+    }
+
+    if (request.getRequestPath().getSelectorString() != null) {
+        String selectors = request.getRequestPath().getSelectorString();
+        selectors = selectors.replace(&#39;.&#39;, &#39;/&#39;);
+        while (selectors != null) {
+            String path = resourceType + &quot;/&quot; + selectors + &quot;/&quot; + baseName;
+            Servlet servlet = findServletFor(path);
+            if (servlet != null) {
+                return servlet;
+            }
+
+            int lastSlash = selectors.lastIndexOf(&#39;/&#39;);
+            if (lastSlash &gt; 0) {
+                selectors = selectors.substring(0, lastSlash);
+            } else {
+                selectors = null;
+            }
+        }
+    }
+
+    String path = resourceType + &quot;/&quot; + baseName;
+    return findScriptFor(path);
+}
+
+Servlet findScriptFor(path) {
+    // Find a Servlet or Script with the given path in the search path
+    // where the Script is allowed to have Script language specific
+    // extension, such as .js, .jsp, etc.
+}
+</code></pre>
+<h2>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>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*FOUND), you could create a script <code>prefix/sling/servlet/errorhandler/404.esp</code> or for a status code 500 (INTERNAL*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>Integration tests</h2>
+<p>A set of simple example servlets is available in the [launchpad/test-services module]({{ refs.http://svn.apache.org/repos/asf/incubator/sling/trunk/launchpad/test-services.path }}). </p>
+<p>Integration tests in the [launchpad/testing module]({{ refs.http://svn.apache.org/repos/asf/incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution.path }}) verify that these examples are correct.</p>
+<p>Contributions to these tests and examples are welcome, of course!</p></section></div></div>            
+<div class="footer">
+                <div class="timestamp">
+                    TODO display revision number here
+                </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>            
+            
+        </div>
+    </body>
+</html>