incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r841833 [24/28] - in /websites/staging/sling/trunk/content: ./ site/ site/46-line-blog.data/ site/authentication.data/ site/documentation.data/ site/first-steps.data/ site/getting-and-building-sling.data/ site/how-to-manage-events-in-sling....
Date Wed, 12 Dec 2012 09:17:17 GMT
Added: websites/staging/sling/trunk/content/site/rewriting-the-output-through-pipelines.html
==============================================================================
--- websites/staging/sling/trunk/content/site/rewriting-the-output-through-pipelines.html (added)
+++ websites/staging/sling/trunk/content/site/rewriting-the-output-through-pipelines.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,145 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Rewriting the Output Through Pipelines</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/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>
+    <DIV class="menu">
+<P><B>Documentation</B><BR clear="all">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR clear="all">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR clear="all">
+<A href="development.html" title="Development">Development</A><BR clear="all">
+<A href="bundles.html" title="Bundles">Bundles</A><BR clear="all">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR clear="all">
+<A href="configuration.html" title="Configuration">Configuration</A><BR clear="all">
+<A href="http://sling.apache.org/apidocs/sling5/index.html" rel="nofollow">API docs</A><BR clear="all">
+<A href="http://cwiki.apache.org/SLING/" rel="nofollow">Wiki</A><BR clear="all">
+<A href="http://cwiki.apache.org/SLING/faq.html" rel="nofollow">FAQ</A><BR clear="all"></P>
+
+<P><B>Project info</B><BR clear="all">
+<A href="http://sling.apache.org/site/downloads.cgi" rel="nofollow">Downloads</A><BR clear="all">
+<A href="contributing.html" title="Contributing">Contributing</A><BR clear="all">
+<A href="news.html" title="News">News</A><BR clear="all">
+<A href="links.html" title="Links">Links</A><BR clear="all">
+<A href="project-information.html" title="Project Information">Project Information</A><BR clear="all"></P>
+
+<P><B>Sponsorship</B><BR clear="all">
+<A href="http://www.apache.org/foundation/thanks.html" rel="nofollow">Thanks</A><BR clear="all">
+<A href="http://www.apache.org/foundation/sponsorship.html" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" rel="nofollow">Buy Stuff</A></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>
+<P style="height: 100px"></P>
+
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="documentation.html" title="Documentation">Documentation</A>&nbsp;&gt;&nbsp;<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How-Tos</A>&nbsp;&gt;&nbsp;<A href="" title="Rewriting the Output Through Pipelines">Rewriting the Output Through Pipelines</A>
+        </DIV>
+<H1><A name="RewritingtheOutputThroughPipelines-ApacheSlingRewriter"></A>Apache Sling Rewriter</H1>
+
+<P>The Apache Sling rewriter is a module for rewriting the output. The output from Sling can be rewritten by a SAX based pipeline or a single component (called a Processor).</P>
+
+<H2><A name="RewritingtheOutputThroughPipelines-SAXPipelines"></A>SAX Pipelines</H2>
+<P>The rewriter allows to configure a pipeline for post processing of the generated response.</P>
+
+<P>The pipeline starts with a generator. The generator gets the output from Sling. It's the task of the generator to generate SAX events (XML) and stream these into the pipeline. A transformer is a component in the middle of the pipeline, a pipeline can have zero to n transformers. The transformer receives SAX events from the previous component in the pipeline and sends SAX events to the next component in the pipeline. A transformer can remove events, change events, add events or just pass on the events. The pipeline ends with a serializer collecting all SAX events and writing the output to a provided output stream.</P>
+
+<P>Sling contains a default pipeline which is executed for all html responses: it starts with an html generator, parsing the html output and sending events into the pipeline. A html serializer collects all events and serializes the output. </P>
+
+<P>The pipelines can be configured in the repository as a child node of <EM>/apps/APPNAME/config/rewriter</EM> (or <EM>/libs/APPNAME/config/rewriterg</EM>). (In fact the configured search paths of the resource resolver are observed.) Each node can have the following properties:</P>
+<UL>
+	<LI>generatorType - the type of the generator (required)</LI>
+	<LI>serializerType - the type of the serializer (required)</LI>
+	<LI>transformerTypes (multivalue string) - the types of the transformers (optional)</LI>
+	<LI>paths (multivalue string) - the paths this pipeline should run on (content paths)</LI>
+	<LI>contentTypes (multivalue string) - the content types this pipeline should be used for (optional)</LI>
+	<LI>order (long) - the configurations are sorted by this order, order must be higher or equal to 0. The configuration with the highest order is tried first.</LI>
+	<LI>enabled (boolean) - Is this configuration active? (default yes)</LI>
+</UL>
+
+
+<P>If a component needs a configuration, the configuration is stored in a child node which name is <EM>COMPONENTTYPE-NAME</EM>, e.g. to configure the html generator (named <EM>html-generator</EM>), the node should have the name <EM>generator-html-generator</EM>.</P>
+
+<H3><A name="RewritingtheOutputThroughPipelines-ConfiguringtheHTMLGenerator"></A>Configuring the HTML Generator</H3>
+
+<P>By default the used html generator only generates events for some of the html tags. If you want to change this, create a pipeline config like outlined above for the pipeline and configure the html generator by adding the <EM>generator-html-generator</EM> node with a multi value string property named <EM>includeTags</EM>. The values define the tags, the parser uses.</P>
+
+<H3><A name="RewritingtheOutputThroughPipelines-DefaultPipeline"></A>Default Pipeline</H3>
+
+<P>The default pipeline is configured for the <EM>text/html</EM> mime type and consists of the <EM>html-generator</EM> as generator, and the <EM>html-serializer</EM> for generating the final response.<BR>
+As the html generated by Sling is not required to be valid XHTML, the html parser is only sending partial SAX events into the pipeline, therefore modifications of the complete page are not possible with this approach. For complete page modifications, the Sling scripts need to generate XHTML and an according parser needs to be used. It is also possible to integrate an HTML parser which converts the HTML to XHTML.</P>
+
+<H2><A name="RewritingtheOutputThroughPipelines-ImplementingPipelineComponents"></A>Implementing Pipeline Components</H2>
+<P>Each pipeline component type has a corresponding Java interface (Generator, Transformer, and Serializer) together with a factory interface (GeneratorFactory, TransformerFactory, and SerializerFactory). When implementing such a component, both interfaces need to be implemented. The factory has only one method which creates a new instance of that type for the current request. The factory has to be registered as a service. For example if you're using the Maven SCR plugin, it looks like this:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+@scr.component metatype=<SPAN class="code-quote">&quot;no&quot;</SPAN> 
+@scr.service <SPAN class="code-keyword">interface</SPAN>=<SPAN class="code-quote">&quot;TransformerFactory&quot;</SPAN>
+@scr.property value=<SPAN class="code-quote">&quot;pipeline.type&quot;</SPAN> value=<SPAN class="code-quote">&quot;validator&quot;</SPAN>
+</PRE>
+</DIV></DIV>
+
+<P>The factory needs to implement the according interface and should be registered as a service for this factory. Each factory gets a unique name through the <EM>pipeline.type</EM> property. The pipeline configuration in the repository just references this unique name (like validator).</P>
+
+<H2><A name="RewritingtheOutputThroughPipelines-ExtendingthePipeline"></A>Extending the Pipeline</H2>
+<P>With the possibilities from above, it is possible to define new pipelines and add custom components to the pipeline. However, in some cases it is required to just add a custom transformer to the existing pipeline. Therefore the rewriting can be configured with pre and post transformers that are simply added to each configured pipeline. This allows a more flexible way of customizing the pipeline without changing/adding a configuration in the repository.</P>
+
+<P>The approach here is nearly the same. A transformer factory needs to be implemented, but instead of giving this factory a unique name, this factory is marked as a global factory:</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+@scr.component metatype=<SPAN class="code-quote">&quot;no&quot;</SPAN>
+@scr.service <SPAN class="code-keyword">interface</SPAN>=<SPAN class="code-quote">&quot;TransformerFactory&quot;</SPAN>
+@scr.property name=<SPAN class="code-quote">&quot;pipeline.mode&quot;</SPAN> value=<SPAN class="code-quote">&quot;global&quot;</SPAN>
+@scr.property name=<SPAN class="code-quote">&quot;service.ranking&quot;</SPAN> value=<SPAN class="code-quote">&quot;RANKING&quot;</SPAN> type=<SPAN class="code-quote">&quot;<SPAN class="code-object">Integer</SPAN>&quot;</SPAN>
+</PRE>
+</DIV></DIV>
+<P><EM>RANKING</EM> is an integer value (don't forget the type attribute otherwise the ranking is interpreted as zero!) specifying where to add the transformer in the pipeline. If the value is less than zero the transformer is added at the beginning of the pipeline right after the generator. If the ranking is equal or higher as zero, the transformer is added at the end of the pipeline before the serializer.</P>
+
+<P>The <EM>TransformerFactory</EM> interface has just one method which returns a new transformer instance. If you plan to use other services in your transformer you might declare the references on the factory and pass in the instances into the newly created transformer.</P>
+
+
+<H2><A name="RewritingtheOutputThroughPipelines-ImplementingaProcessor"></A>Implementing a Processor</H2>
+<P>A processor must conform to the Java interface <EM>org.apache.sling.rewriter.Processor</EM>. It gets initializd (method <EM>init</EM>) with the <EM>ProcessingContext</EM>. This context contains all necessary information for the current request (especially the output writer to write the rewritten content to).<BR>
+The <EM>getWriter</EM> method should return a writer where the output is written to. When the output is written or an error occured <EM>finished</EM> is called.</P>
+
+<P>Like the pipeline components a processor is generated by a factory which has to be registered as a service factory, like this:</P>
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+@scr.component metatype=<SPAN class="code-quote">&quot;no&quot;</SPAN> 
+@scr.service <SPAN class="code-keyword">interface</SPAN>=<SPAN class="code-quote">&quot;ProcessorFactory&quot;</SPAN>
+@scr.property value=<SPAN class="code-quote">&quot;pipeline.type&quot;</SPAN> value=<SPAN class="code-quote">&quot;uniqueName&quot;</SPAN>
+</PRE>
+</DIV></DIV>
+
+<H2><A name="RewritingtheOutputThroughPipelines-ConfiguringaProcessor"></A>Configuring a Processor</H2>
+<P>The processors can be configured in the repository as a child node of <EM>/apps/APPNAME/config/rewriter</EM> (or libs or any configured search path). Each node can have the following properties:</P>
+<UL>
+	<LI>processorType - the type of the processor (required) - this is the part from the scr factory information after the slash (in the example above this is <EM>uniqueName</EM>)</LI>
+	<LI>paths (multivalue string) - the paths this processor should run on (content paths)</LI>
+	<LI>contentTypes (multivalue string) - the content types this processor should be used for (optional)</LI>
+	<LI>order (long) - the configurations are sorted by this order, order must be higher or equal to 0. The configuration with the highest order is tried first.</LI>
+	<LI>enabled (boolean) - Is this configuration active? (default yes)</LI>
+</UL>
+
+
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by cziegeler@apache.org on 2009-06-09 03:15:45.0
+        </DIV>
+    </DIV>
+  </BODY>
+</HTML>
+

Added: websites/staging/sling/trunk/content/site/run-modes-orgapacheslingrunmode.html
==============================================================================
--- websites/staging/sling/trunk/content/site/run-modes-orgapacheslingrunmode.html (added)
+++ websites/staging/sling/trunk/content/site/run-modes-orgapacheslingrunmode.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,114 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Run Modes (org.apache.sling.runmode)</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/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><B>Documentation</B><BR class="atl-forced-newline">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="configuration.html" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse Source Repository</A><BR class="atl-forced-newline">
+<A href="security.html" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy Stuff</A></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>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="old-stuff.html" title="Old Stuff">Old Stuff</A>&nbsp;&gt;&nbsp;<A href="" title="Run Modes (org.apache.sling.runmode)">Run Modes (org.apache.sling.runmode)</A>
+        </DIV>
+<DIV class="panelMacro"><TABLE class="noteMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>As of Sling 6 the <TT>org.apache.sling.runmode</TT> bundle is replaced by the new <A href="sling-settings-orgapacheslingsettings.html" title="Sling Settings (org.apache.sling.settings)">Sling Settings &#40;org.apache.sling.settings&#41;</A> Bundle. For backwards compatibility this bundle may still exist in your environment. New code should use the API of the new <A href="sling-settings-orgapacheslingsettings.html" title="Sling Settings (org.apache.sling.settings)">Sling Settings &#40;org.apache.sling.settings&#41;</A> Bundle, though.</TD></TR></TABLE></DIV>
+
+<H1><A name="RunModes%28org.apache.sling.runmode%29-Overview"></A>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="http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/runmode" class="external-link" rel="nofollow">org.apache.sling.runmode</A></EM> bundle provides a simple way of defining and querying a list of run modes.</P>
+
+<H1><A name="RunModes%28org.apache.sling.runmode%29-Installation"></A>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><A name="RunModes%28org.apache.sling.runmode%29-Configuration"></A>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><A name="RunModes%28org.apache.sling.runmode%29-Gettingthecurrentlistofrunmodes"></A>Getting the current list of run modes</H1>
+
+<P>The <A href="http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/runmode/src/main/java/org/apache/sling/runmode/RunMode.java" class="external-link" rel="nofollow">RunMode service</A> provides the current list of run modes, examples:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeHeader panelHeader" style="border-bottom-width: 1px;"><B>RunMode examples</B></DIV><DIV class="codeContent panelContent">
+<PRE class="code-java">
+RunMode r = ...get from BundleContext...
+<SPAN class="code-object">String</SPAN> [] currentRunModes = r.getCurrentRunModes();
+
+<SPAN class="code-object">String</SPAN> [] expectedRunModes = { <SPAN class="code-quote">&quot;foo&quot;</SPAN>, <SPAN class="code-quote">&quot;wii&quot;</SPAN> };
+<SPAN class="code-keyword">if</SPAN>(r.isActive(expectedRunModes)) {
+  <SPAN class="code-comment">// at least one of (foo,wii) run modes
+</SPAN>  <SPAN class="code-comment">// is active
+</SPAN>}
+</PRE>
+</DIV></DIV>
+
+<H1><A name="RunModes%28org.apache.sling.runmode%29-Seealso"></A>See also</H1>
+
+<P>The RunMode service is used by the <A href="jcr-installer-provider.html" title="JCR Installer Provider">jcrinstall</A> services.</P>
+
+<H1><A name="RunModes%28org.apache.sling.runmode%29-Automatedtests"></A>Automated tests</H1>
+
+<P>The <A href="http://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/runmode/src/test/java/org/apache/sling/runmode/impl/RunModeImplTest.java" class="external-link" rel="nofollow">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;">
+Last modified by cziegeler@apache.org on 2011-10-11 05:23:51.0
+        </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/site/scheduler-service-commons-scheduler.html
==============================================================================
--- websites/staging/sling/trunk/content/site/scheduler-service-commons-scheduler.html (added)
+++ websites/staging/sling/trunk/content/site/scheduler-service-commons-scheduler.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,296 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Scheduler Service (commons scheduler)</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/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><B>Documentation</B><BR class="atl-forced-newline">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="configuration.html" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse Source Repository</A><BR class="atl-forced-newline">
+<A href="security.html" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy Stuff</A></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>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="documentation.html" title="Documentation">Documentation</A>&nbsp;&gt;&nbsp;<A href="bundles.html" title="Bundles">Bundles</A>&nbsp;&gt;&nbsp;<A href="" title="Scheduler Service (commons scheduler)">Scheduler Service (commons scheduler)</A>
+        </DIV>
+<H1><A name="SchedulerService%28commonsscheduler%29-TheCommonsScheduler"></A>The Commons Scheduler</H1>
+
+<P>The scheduler is a service for scheduling other services/jobs (it uses the open source Quartz library). The scheduler can be used in two ways, by registering the job through the scheduler API and by leveraging the whiteboard pattern that is supported by the scheduler.</P>
+
+<H2><A name="SchedulerService%28commonsscheduler%29-TheSchedulerAPI"></A>The Scheduler API</H2>
+
+<P>The scheduler has methods to execute jobs periodically, based on a cron expression or at a given time. For more details please refer to the <A href="http://sling.apache.org/apidocs/sling5/index.html?org%2Fapache%2Fsling%2Fcommons%2Fscheduler%2FScheduler.html" class="external-link" rel="nofollow">javadocs</A>.</P>
+
+<H2><A name="SchedulerService%28commonsscheduler%29-ExamplesofscheduledjobsregisteredthroughtheschedulerAPI"></A>Examples of scheduled jobs registered through the scheduler API</H2>
+
+<P>The following examples show you how to define and schedule a job that is registered through the scheduler api.</P>
+
+<H3><A name="SchedulerService%28commonsscheduler%29-Definingthejob"></A>Defining the job</H3>
+
+<P>The following code sample defines a <B>job</B> object that writes a message in the logs:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java"> 
+<SPAN class="code-keyword">final</SPAN> <SPAN class="code-object">Runnable</SPAN> job = <SPAN class="code-keyword">new</SPAN> <SPAN class="code-object">Runnable</SPAN>() {
+	<SPAN class="code-keyword">public</SPAN> void run() {
+		log.info(<SPAN class="code-quote">&quot;Executing the job&quot;</SPAN>);
+	}
+};
+</PRE>
+</DIV></DIV> 
+
+<H3><A name="SchedulerService%28commonsscheduler%29-Schedulingwithacronexpression"></A>Scheduling with a cron expression</H3>
+
+<P>To execute the job as defined above at 10:15am every Monday, Tuesday, Wednesday, Thursday and Friday, you can use the <B>addJob()</B> method with the following parameters:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java"> 
+<SPAN class="code-object">String</SPAN> schedulingExpression = <SPAN class="code-quote">&quot;0 15 10 ? * MON-FRI&quot;</SPAN>;
+<SPAN class="code-keyword">this</SPAN>.scheduler.addJob(<SPAN class="code-quote">&quot;myJob&quot;</SPAN>, job, <SPAN class="code-keyword">null</SPAN>, schedulingExpression, <SPAN class="code-keyword">true</SPAN>);
+</PRE>
+</DIV></DIV>
+
+<P>Refer to <A href="http://www.docjar.com/docs/api/org/quartz/CronTrigger.html" class="external-link" rel="nofollow">http://www.docjar.com/docs/api/org/quartz/CronTrigger.html</A><BR>
+ to define more scheduling expressions.</P>
+
+<H3><A name="SchedulerService%28commonsscheduler%29-Schedulingatperiodictimes"></A>Scheduling at periodic times</H3>
+
+<P>To execute the job as defined above every 3 minutes (180 seconds), you can use the <B>addPeriodicJob()</B> method with the following parameters:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+<SPAN class="code-object">long</SPAN> period = 3*60; <SPAN class="code-comment">//the period is expressed in seconds
+</SPAN><SPAN class="code-keyword">this</SPAN>.scheduler.addPeriodicJob(<SPAN class="code-quote">&quot;myJob&quot;</SPAN>, job, <SPAN class="code-keyword">null</SPAN>, period, <SPAN class="code-keyword">true</SPAN>);
+</PRE>
+</DIV></DIV>
+
+<H3><A name="SchedulerService%28commonsscheduler%29-Schedulingatagiventime"></A>Scheduling at a given time</H3>
+
+<P>To execute the job as defined above at a specific date (on January 10th 2020), you can use the <B>fireJobAt()</B> method with the following parameters:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+SimpleDateFormat formatter = <SPAN class="code-keyword">new</SPAN> SimpleDateFormat(<SPAN class="code-quote">&quot;yyyy/MM/dd&quot;</SPAN>);
+<SPAN class="code-object">String</SPAN> date = <SPAN class="code-quote">&quot;2020/01/10&quot;</SPAN>;
+java.util.Date fireDate = formatter.parse(date);
+<SPAN class="code-keyword">this</SPAN>.scheduler.fireJobAt(<SPAN class="code-quote">&quot;myJob&quot;</SPAN>, job, <SPAN class="code-keyword">null</SPAN>, fireDate);
+</PRE>
+</DIV></DIV>
+
+
+<H3><A name="SchedulerService%28commonsscheduler%29-Aserviceschedulingthejobbasedon3differentkindsofscheduling"></A>A service scheduling the job based on 3 different kinds of scheduling</H3>
+
+<P>The code implementing a service that simultaneously executes the job based on 3 different kinds of scheduling can look as follows:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+<SPAN class="code-keyword">package</SPAN> sling.docu.examples;
+
+<SPAN class="code-keyword">import</SPAN> java.io.Serializable;
+<SPAN class="code-keyword">import</SPAN> java.util.Date;
+<SPAN class="code-keyword">import</SPAN> java.util.HashMap;
+<SPAN class="code-keyword">import</SPAN> java.util.Map;
+
+<SPAN class="code-keyword">import</SPAN> org.apache.sling.commons.scheduler.Scheduler;
+<SPAN class="code-keyword">import</SPAN> org.osgi.service.component.ComponentContext;
+<SPAN class="code-keyword">import</SPAN> org.slf4j.Logger;
+<SPAN class="code-keyword">import</SPAN> org.slf4j.LoggerFactory;
+
+/**
+ *  This service executes scheduled jobs
+ *  
+ *	@scr.component immediate=<SPAN class="code-quote">&quot;<SPAN class="code-keyword">true</SPAN>&quot;</SPAN> metatype=<SPAN class="code-quote">&quot;<SPAN class="code-keyword">false</SPAN>&quot;</SPAN>
+ *
+ */
+<SPAN class="code-keyword">public</SPAN> class HelloWorldScheduledService {
+	
+    /** Default log. */
+    <SPAN class="code-keyword">protected</SPAN> <SPAN class="code-keyword">final</SPAN> Logger log = LoggerFactory.getLogger(<SPAN class="code-keyword">this</SPAN>.getClass());
+    
+    /** The scheduler <SPAN class="code-keyword">for</SPAN> rescheduling jobs.
+     * @scr.reference */
+    <SPAN class="code-keyword">private</SPAN> Scheduler scheduler;
+    
+
+    <SPAN class="code-keyword">protected</SPAN> void activate(ComponentContext componentContext) <SPAN class="code-keyword">throws</SPAN> Exception {
+        <SPAN class="code-comment">//<SPAN class="code-keyword">case</SPAN> 1: with addJob() method: executes the job every minute
+</SPAN>    	<SPAN class="code-object">String</SPAN> schedulingExpression = <SPAN class="code-quote">&quot;0 * * * * ?&quot;</SPAN>;
+    	<SPAN class="code-object">String</SPAN> jobName1 = <SPAN class="code-quote">&quot;case1&quot;</SPAN>;
+    	Map&lt;<SPAN class="code-object">String</SPAN>, Serializable&gt; config1 = <SPAN class="code-keyword">new</SPAN> HashMap&lt;<SPAN class="code-object">String</SPAN>, Serializable&gt;();
+    	<SPAN class="code-object">boolean</SPAN> canRunConcurrently = <SPAN class="code-keyword">true</SPAN>;
+        <SPAN class="code-keyword">final</SPAN> <SPAN class="code-object">Runnable</SPAN> job1 = <SPAN class="code-keyword">new</SPAN> <SPAN class="code-object">Runnable</SPAN>() {
+            <SPAN class="code-keyword">public</SPAN> void run() {
+            	log.info(<SPAN class="code-quote">&quot;Executing job1&quot;</SPAN>);
+            }
+        };
+        <SPAN class="code-keyword">try</SPAN> {
+        	<SPAN class="code-keyword">this</SPAN>.scheduler.addJob(jobName1, job1, config1, schedulingExpression, canRunConcurrently);
+        } <SPAN class="code-keyword">catch</SPAN> (Exception e) {
+            job1.run();
+        }
+    	
+        <SPAN class="code-comment">//<SPAN class="code-keyword">case</SPAN> 2: with addPeriodicJob(): executes the job every 3 minutes
+</SPAN>        <SPAN class="code-object">String</SPAN> jobName2 = <SPAN class="code-quote">&quot;case2&quot;</SPAN>;
+    	<SPAN class="code-object">long</SPAN> period = 180;
+    	Map&lt;<SPAN class="code-object">String</SPAN>, Serializable&gt; config2 = <SPAN class="code-keyword">new</SPAN> HashMap&lt;<SPAN class="code-object">String</SPAN>, Serializable&gt;();
+        <SPAN class="code-keyword">final</SPAN> <SPAN class="code-object">Runnable</SPAN> job2 = <SPAN class="code-keyword">new</SPAN> <SPAN class="code-object">Runnable</SPAN>() {
+            <SPAN class="code-keyword">public</SPAN> void run() {
+            	log.info(<SPAN class="code-quote">&quot;Executing job2&quot;</SPAN>);
+            }
+        };
+        <SPAN class="code-keyword">try</SPAN> {
+        	<SPAN class="code-keyword">this</SPAN>.scheduler.addPeriodicJob(jobName2, job2, config2, period, canRunConcurrently);
+        } <SPAN class="code-keyword">catch</SPAN> (Exception e) {
+            job2.run();
+        }
+
+        <SPAN class="code-comment">//<SPAN class="code-keyword">case</SPAN> 3: with fireJobAt(): executes the job at a specific date (date of deployment + delay of 30 seconds)
+</SPAN>        <SPAN class="code-object">String</SPAN> jobName3 = <SPAN class="code-quote">&quot;case3&quot;</SPAN>;
+    	<SPAN class="code-keyword">final</SPAN> <SPAN class="code-object">long</SPAN> delay = 30*1000;
+    	<SPAN class="code-keyword">final</SPAN> Date fireDate = <SPAN class="code-keyword">new</SPAN> Date();
+        fireDate.setTime(<SPAN class="code-object">System</SPAN>.currentTimeMillis() + delay);
+    	Map&lt;<SPAN class="code-object">String</SPAN>, Serializable&gt; config3 = <SPAN class="code-keyword">new</SPAN> HashMap&lt;<SPAN class="code-object">String</SPAN>, Serializable&gt;();
+        <SPAN class="code-keyword">final</SPAN> <SPAN class="code-object">Runnable</SPAN> job3 = <SPAN class="code-keyword">new</SPAN> <SPAN class="code-object">Runnable</SPAN>() {
+            <SPAN class="code-keyword">public</SPAN> void run() {
+            	log.info(<SPAN class="code-quote">&quot;Executing job3 at date: {} with a delay of: {} seconds&quot;</SPAN>, fireDate, delay/1000);
+            }
+        };
+        <SPAN class="code-keyword">try</SPAN> {
+        	<SPAN class="code-keyword">this</SPAN>.scheduler.fireJobAt(jobName3, job3, config3, fireDate);
+        } <SPAN class="code-keyword">catch</SPAN> (Exception e) {
+            job3.run();
+        }
+    }
+
+    <SPAN class="code-keyword">protected</SPAN> void deactivate(ComponentContext componentContext) {
+        log.info(<SPAN class="code-quote">&quot;Deactivated, goodbye!&quot;</SPAN>);
+    }
+
+}
+</PRE>
+</DIV></DIV>
+
+<H2><A name="SchedulerService%28commonsscheduler%29-Examplesofjobsthatarescheduledbyleveragingthewhiteboardpattern"></A>Examples of jobs that are scheduled by leveraging the whiteboard pattern </H2>
+
+<P>The following examples show you how to define and schedule a job by leveraging the whiteboard pattern.</P>
+
+<H3><A name="SchedulerService%28commonsscheduler%29-Schedulingwithacronexpression"></A>Scheduling with a cron expression </H3>
+
+<P>The following job is executed every minute by setting <B>scheduler.expression</B> to the cron expression <B>&quot;0 * * * * ?&quot;</B>:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+<SPAN class="code-keyword">package</SPAN> sling.docu.examples;
+
+<SPAN class="code-keyword">import</SPAN> org.slf4j.Logger;
+<SPAN class="code-keyword">import</SPAN> org.slf4j.LoggerFactory;
+
+/**
+ * @scr.component
+ * @scr.service <SPAN class="code-keyword">interface</SPAN>=<SPAN class="code-quote">&quot;java.lang.<SPAN class="code-object">Runnable</SPAN>&quot;</SPAN>
+ * @scr.property name=<SPAN class="code-quote">&quot;scheduler.expression&quot;</SPAN> value=<SPAN class="code-quote">&quot;0 * * * * ?&quot;</SPAN>
+ */
+<SPAN class="code-keyword">public</SPAN> class ScheduledCronJob <SPAN class="code-keyword">implements</SPAN> <SPAN class="code-object">Runnable</SPAN> {
+
+	/** Default log. */
+    <SPAN class="code-keyword">protected</SPAN> <SPAN class="code-keyword">final</SPAN> Logger log = LoggerFactory.getLogger(<SPAN class="code-keyword">this</SPAN>.getClass());
+    
+    <SPAN class="code-keyword">public</SPAN> void run() {
+    	log.info(<SPAN class="code-quote">&quot;Executing a cron job (job#1) through the whiteboard pattern&quot;</SPAN>);
+    }
+<SPAN class="code-comment">//
+</SPAN>}
+</PRE>
+</DIV></DIV>
+
+<H3><A name="SchedulerService%28commonsscheduler%29-Schedulingatperiodictimes"></A>Scheduling at periodic times </H3>
+
+<P>The following job is executed every ten seconds by setting <B>scheduler.period</B> to <B>10</B>:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+<SPAN class="code-keyword">package</SPAN> sling.docu.examples;
+
+<SPAN class="code-keyword">import</SPAN> org.slf4j.Logger;
+<SPAN class="code-keyword">import</SPAN> org.slf4j.LoggerFactory;
+
+/**
+ * @scr.component
+ * @scr.service <SPAN class="code-keyword">interface</SPAN>=<SPAN class="code-quote">&quot;java.lang.<SPAN class="code-object">Runnable</SPAN>&quot;</SPAN>
+ * @scr.property name=<SPAN class="code-quote">&quot;scheduler.period&quot;</SPAN> value=<SPAN class="code-quote">&quot;10&quot;</SPAN> type=<SPAN class="code-quote">&quot;<SPAN class="code-object">Long</SPAN>&quot;</SPAN>
+ */
+<SPAN class="code-keyword">public</SPAN> class ScheduledPeriodicJob <SPAN class="code-keyword">implements</SPAN> <SPAN class="code-object">Runnable</SPAN> {
+
+	/** Default log. */
+    <SPAN class="code-keyword">protected</SPAN> <SPAN class="code-keyword">final</SPAN> Logger log = LoggerFactory.getLogger(<SPAN class="code-keyword">this</SPAN>.getClass());
+    
+    <SPAN class="code-keyword">public</SPAN> void run() {
+    	log.info(<SPAN class="code-quote">&quot;Executing a perodic job (job#2) through the whiteboard pattern&quot;</SPAN>);
+    }
+<SPAN class="code-comment">//
+</SPAN>}
+</PRE>
+</DIV></DIV>
+
+<H3><A name="SchedulerService%28commonsscheduler%29-Preventingconcurrentexecution"></A>Preventing concurrent execution</H3>
+
+<P>By default, jobs can be concurrently executed. To prevent this, set the <B>scheduler.concurrent</B> property to <B>false</B>:</P>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+@scr.property name=<SPAN class="code-quote">&quot;scheduler.concurrent&quot;</SPAN> value=<SPAN class="code-quote">&quot;<SPAN class="code-keyword">false</SPAN>&quot;</SPAN> type=<SPAN class="code-quote">&quot;<SPAN class="code-object">Boolean</SPAN>&quot;</SPAN>
+</PRE>
+</DIV></DIV>
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by justinedelson on 2011-07-26 17:42:02.0
+        </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/site/scriptengineintegration.html
==============================================================================
--- websites/staging/sling/trunk/content/site/scriptengineintegration.html (added)
+++ websites/staging/sling/trunk/content/site/scriptengineintegration.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,88 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - ScriptEngineIntegration</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/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><B>Documentation</B><BR class="atl-forced-newline">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="configuration.html" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse Source Repository</A><BR class="atl-forced-newline">
+<A href="security.html" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy Stuff</A></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>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="old-stuff.html" title="Old Stuff">Old Stuff</A>&nbsp;&gt;&nbsp;<A href="" title="ScriptEngineIntegration">ScriptEngineIntegration</A>
+        </DIV>
+<H1><A name="ScriptEngineIntegration-IntegratingScriptingLanguages"></A>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:
+	<UL>
+		<LI>Create the ScriptEngine[Factory] implementations</LI>
+		<LI>Create a bundle comprising the above implementations as well as the script language implementation.</LI>
+		<LI>Create the <TT>META-INF/services/javax.script.ScriptEngineFactory</TT> file listing the fully qualified name of your ScriptEngineFactory implementaiton</LI>
+	</UL>
+	</LI>
+</UL>
+
+
+
+<H1><A name="ScriptEngineIntegration-NotesonScriptEngines"></A>Notes on ScriptEngines</H1>
+
+<UL><LI><A href="groovy-support.html" title="Groovy Support">Groovy Support</A> &mdash; <SPAN class="smalltext">Explains how to add support for Groovy to Apache Sling.</SPAN></LI><LI><A href="xslt-processing-pipeline.html" title="XSLT Processing Pipeline">XSLT Processing Pipeline</A> &mdash; <SPAN class="smalltext">Explains how to use the XSLT processing support (script extension <TT>.xpl</TT>)</SPAN></LI></UL>
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by mykee on 2008-12-09 00:45:12.0
+        </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/site/security.html
==============================================================================
--- websites/staging/sling/trunk/content/site/security.html (added)
+++ websites/staging/sling/trunk/content/site/security.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,105 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Security</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/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><B>Documentation</B><BR class="atl-forced-newline">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="configuration.html" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse Source Repository</A><BR class="atl-forced-newline">
+<A href="" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy Stuff</A></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>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="project-information.html" title="Project Information">Project Information</A>&nbsp;&gt;&nbsp;<A href="" title="Security">Security</A>
+        </DIV>
+<H1><A name="Security-ReportingNewSecurityProblemswithApacheSling"></A>Reporting New Security Problems with Apache Sling</H1>
+
+<P>The Apache Software Foundation takes a very active stance in eliminating security problems and denial of service attacks against Apache Sling.</P>
+
+<P>We strongly encourage folks to report such problems to our private security mailing list first, before disclosing them in a public forum.</P>
+
+<P><B>Please note that the security mailing list should only be used for reporting undisclosed security vulnerabilities in Apache Sling and managing the process of fixing such vulnerabilities. We cannot accept regular bug reports or other queries at this address. All mail sent to this address that does not relate to an undisclosed security problem in the Apache Sling source code will be ignored.</B></P>
+
+<P>If you need to report a bug that isn't an undisclosed security vulnerability, please use our <A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">public issue tracker</A>.</P>
+
+<P>Questions about:</P>
+
+<UL>
+	<LI>how to configure Sling securely</LI>
+	<LI>whether a published vulnerability applies to your particular application</LI>
+	<LI>obtaining further information on a published vulnerability</LI>
+	<LI>availability of patches and/or new releases</LI>
+</UL>
+
+
+<P>should be addressed to our public users mailing list. Please see the <A href="project-information.html" title="Project Information">Project Information</A> page for details of how to subscribe.</P>
+
+<P>The private security mailing address is: <A href="mailto:security@sling.apache.org" class="external-link" rel="nofollow">security@sling.apache.org</A>.</P>
+
+<P>Note that all networked servers are subject to denial of service attacks, and we cannot promise magic workarounds to generic problems (such as a client streaming lots of data to your server, or re-requesting the same URL repeatedly). In general our philosophy is to avoid any attacks which can cause the server to consume resources in a non-linear relationship to the size of inputs.</P>
+
+<P>For more information on handling security issues at the Apache Software Foundation please refer to the <A href="http://www.apache.org/security/" class="external-link" rel="nofollow">ASF Security Team</A> page and to the <A href="http://www.apache.org/security/committers.html" class="external-link" rel="nofollow">security process description for committers</A>.</P>
+
+<H1><A name="Security-Errorsandomissions"></A>Errors and omissions</H1>
+
+<P>Please report any errors or omissions to <A href="mailto:security@sling.apache.org" class="external-link" rel="nofollow">security@sling.apache.org</A>.</P>
+
+<H1><A name="Security-Previouslyreportedsecurityissues"></A>Previously reported security issues</H1>
+<UL>
+	<LI>CVE-2012-2138 - Apache Sling denial of service vulnerability (July 6th, 2012), see <A href="http://s.apache.org/CVE-2012-2138" class="external-link" rel="nofollow">http://s.apache.org/CVE-2012-2138</A></LI>
+</UL>
+
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by bdelacretaz on Mon Jul 09 09:53:10 EDT 2012
+        </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/site/servlet-resolution.html
==============================================================================
--- websites/staging/sling/trunk/content/site/servlet-resolution.html (added)
+++ websites/staging/sling/trunk/content/site/servlet-resolution.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,299 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<HTML>
+  <HEAD>
+    <TITLE>Apache Sling - Servlet Resolution</TITLE>
+    <LINK rel="stylesheet" href="http://sling.apache.org/site/media.data/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><B>Documentation</B><BR class="atl-forced-newline">
+<A href="getting-started.html" title="Getting Started">Getting Started</A><BR class="atl-forced-newline">
+<A href="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A><BR class="atl-forced-newline">
+<A href="development.html" title="Development">Development</A><BR class="atl-forced-newline">
+<A href="bundles.html" title="Bundles">Bundles</A><BR class="atl-forced-newline">
+<A href="tutorials-how-tos.html" title="Tutorials & How-Tos">Tutorials &amp; How&#45;Tos</A><BR class="atl-forced-newline">
+<A href="configuration.html" title="Configuration">Configuration</A><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/apidocs/sling6/index.html" class="external-link" rel="nofollow">API docs</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.wiki" class="external-link" rel="nofollow">Wiki</A><BR class="atl-forced-newline">
+<A href="http://s.apache.org/sling.faq" class="external-link" rel="nofollow">FAQ</A><BR class="atl-forced-newline"></P>
+
+<P><B>Project info</B><BR class="atl-forced-newline">
+<A href="http://sling.apache.org/site/downloads.cgi" class="external-link" rel="nofollow">Downloads</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/licenses/" class="external-link" rel="nofollow">License</A><BR class="atl-forced-newline">
+<A href="contributing.html" title="Contributing">Contributing</A><BR class="atl-forced-newline">
+<A href="news.html" title="News">News</A><BR class="atl-forced-newline">
+<A href="links.html" title="Links">Links</A><BR class="atl-forced-newline">
+<A href="project-information.html" title="Project Information">Project Information</A><BR class="atl-forced-newline">
+<A href="https://issues.apache.org/jira/browse/SLING" class="external-link" rel="nofollow">Issue Tracker</A><BR class="atl-forced-newline">
+<A href="http://svn.apache.org/viewvc/sling/trunk" class="external-link" rel="nofollow">Browse Source Repository</A><BR class="atl-forced-newline">
+<A href="security.html" title="Security">Security</A><BR class="atl-forced-newline"></P>
+
+<P><B>Sponsorship</B><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/thanks.html" class="external-link" rel="nofollow">Thanks</A><BR class="atl-forced-newline">
+<A href="http://www.apache.org/foundation/sponsorship.html" class="external-link" rel="nofollow">Become a Sponsor</A><BR>
+<A href="http://www.apache.org/foundation/buy_stuff.html" class="external-link" rel="nofollow">Buy Stuff</A></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>
+  <P style="height: 135px"></P>
+    </DIV>
+    <DIV class="main">
+        <DIV class="breadcrump" style="font-size: 80%;">
+<A href="apache-sling.html" title="Apache Sling Website">Apache Sling Website</A>&nbsp;&gt;&nbsp;<A href="apache-sling.html" title="Apache Sling">Apache Sling</A>&nbsp;&gt;&nbsp;<A href="old-stuff.html" title="Old Stuff">Old Stuff</A>&nbsp;&gt;&nbsp;<A href="" title="Servlet Resolution">Servlet Resolution</A>
+        </DIV>
+<H1><A name="ServletResolution-ServletResolution"></A>Servlet Resolution</H1>
+
+<DIV class="panelMacro"><TABLE class="warningMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B>Out Of Sync</B><BR>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="https://issues.apache.org/jira/browse/SLING-387" class="external-link" rel="nofollow">SLING-387</A>. See the links to integration tests at the end of this page for the Current Truth.
+
+<P>Please see the new <A href="servlets.html" title="Servlets">Servlets</A> page.</P></TD></TR></TABLE></DIV>
+
+<DIV>
+<UL>
+    <LI><A href="#ServletResolution-ServletsareResources">Servlets are Resources</A></LI>
+<UL>
+    <LI><A href="#ServletResolution-Example%253ARegistrationbyPath">Example: Registration by Path</A></LI>
+    <LI><A href="#ServletResolution-Example%253ARegistrationbyResourceTypeetc.">Example: Registration by Resource Type etc.</A></LI>
+</UL>
+    <LI><A href="#ServletResolution-ScriptsareServlets">Scripts are Servlets</A></LI>
+    <LI><A href="#ServletResolution-ResolutionProcess">Resolution Process</A></LI>
+    <LI><A href="#ServletResolution-DefaultServlet%2528s%2529">Default Servlet(s)</A></LI>
+    <LI><A href="#ServletResolution-ErrorHandlerServlet%2528s%2529">Error Handler Servlet(s)</A></LI>
+    <LI><A href="#ServletResolution-Integrationtests">Integration tests</A></LI>
+</UL></DIV>
+
+
+<H2><A name="ServletResolution-ServletsareResources"></A>Servlets are Resources</H2>
+
+<P>As explained on the <A href="resources.html" title="Resources">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 <TT>ResourceResolver</TT>.</P>
+
+<P>To show a Servlet inside the Resource tree, the <TT>sling/servlet-resolver</TT> project provides a <TT>ServletResourceProvider</TT> implementing the <TT>ResourceProvider</TT> interface. For each Servlet registered as an OSGi service with one or more defined service reference properties a <TT>ServletResourceProvider</TT> instance is registered.</P>
+
+<P>The following service reference properties are defined for Servlets defined as OSGi services of type <TT>javax.servlet.Servlet</TT>:</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Name </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.servlet.paths</TT> </TD>
+<TD class="confluenceTd"> 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 class="confluenceTd"> <TT>sling.servlet.resourceTypes</TT> </TD>
+<TD class="confluenceTd"> 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 <TT>sling.servlet.paths</TT> property is set. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.servlet.selectors</TT> </TD>
+<TD class="confluenceTd">  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 &lt;em&gt;print.a4&lt;/em&gt;. The property value must either be a single String, an array of Strings or a Vector of Strings. This property is ignored if the <TT>sling.servlet.paths</TT> property is set. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.servlet.extensions</TT> </TD>
+<TD class="confluenceTd"> 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 <TT>sling.servlet.paths</TT> property is set. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.servlet.methods</TT> </TD>
+<TD class="confluenceTd">  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 <TT>sling.servlet.paths</TT> property is set. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.servlet.prefix</TT> </TD>
+<TD class="confluenceTd">  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 <TT>ResourceResolver</TT> at the time of registration. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+
+<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 <TT>sling.servlet.paths</TT> or the <TT>sling.servlet.resourceTypes</TT> service reference property must be set. If neither is set, the Servlet service is ignored.</LI>
+	<LI>If the <TT>sling.servlet.paths</TT> property is set, all other <TT>sling.servlet.*</TT> 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 &ndash; either from the <TT>sling.servlet.paths</TT> property or constructed from the other <TT>sling.servlet.*</TT> properties &ndash; must be absolute. Any relative path is made absolute by prefixing it with a root path. This prefix may be set with the <TT>sling.servlet.prefix</TT> service registration property. If this property is not set, the first entry in the <TT>ResourceResolver</TT> search path for the <TT>ResourceResolver.getResource(String)</TT> method is used as the prefix. If this entry cannot be derived, a simpe slash &ndash; <TT>/</TT> &ndash; is used as the prefix.</P>
+
+
+<H3><A name="ServletResolution-Example%3ARegistrationbyPath"></A>Example: Registration by Path</H3>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+sling.servlet.paths = [ <SPAN class="code-quote">&quot;/libs/sling/sample/html&quot;</SPAN>, <SPAN class="code-quote">&quot;/libs/sling/sample/txt&quot;</SPAN> ]
+sling.servlet.resourceTypes = [ <SPAN class="code-quote">&quot;sling/unused&quot;</SPAN> ]
+sling.servlet.selectors = [ <SPAN class="code-quote">&quot;img&quot;</SPAN> ]
+sling.servlet.extensions = [ <SPAN class="code-quote">&quot;html&quot;</SPAN>, <SPAN class="code-quote">&quot;txt&quot;</SPAN>, <SPAN class="code-quote">&quot;json&quot;</SPAN> ]
+</PRE>
+</DIV></DIV>
+
+<P>A Servlet service registered with these properties is registered under the following paths:</P>
+
+<UL>
+	<LI><TT>/libs/sling/sample/html</TT></LI>
+	<LI><TT>/libs/sling/sample/txt</TT></LI>
+</UL>
+
+
+<P>The registration properties <TT>sling.servlet.resourceTypes</TT>, <TT>sling.servlet.selectors</TT> and <TT>sling.servlet.extensions</TT> are ignored because the <TT>sling.servlet.paths</TT> property is set.</P>
+
+
+<H3><A name="ServletResolution-Example%3ARegistrationbyResourceTypeetc."></A>Example: Registration by Resource Type etc.</H3>
+
+<DIV class="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+sling.servlet.resourceTypes = [ <SPAN class="code-quote">&quot;sling/unused&quot;</SPAN> ]
+sling.servlet.selectors = [ <SPAN class="code-quote">&quot;img&quot;</SPAN>, <SPAN class="code-quote">&quot;tab&quot;</SPAN> ]
+sling.servlet.extensions = [ <SPAN class="code-quote">&quot;html&quot;</SPAN>, <SPAN class="code-quote">&quot;txt&quot;</SPAN>, <SPAN class="code-quote">&quot;json&quot;</SPAN> ]
+</PRE>
+</DIV></DIV>
+
+<P>A Servlet service registered with these properties is registered under the following paths:</P>
+
+<UL>
+	<LI><TT><EM>prefix</EM>/sling/unused/img/html</TT></LI>
+	<LI><TT><EM>prefix</EM>/sling/unused/img/txt</TT></LI>
+	<LI><TT><EM>prefix</EM>/sling/unused/img/json</TT></LI>
+	<LI><TT><EM>prefix</EM>/sling/unused/tab/html</TT></LI>
+	<LI><TT><EM>prefix</EM>/sling/unused/tab/txt</TT></LI>
+	<LI><TT><EM>prefix</EM>/sling/unused/tab/json</TT></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 <TT><EM>prefix</EM></TT> is defined.</P>
+
+
+<H2><A name="ServletResolution-ScriptsareServlets"></A>Scripts are Servlets</H2>
+
+
+<P>The Sling API defines a <TT>SlingScript</TT> interface which is used to represent (executable) scripts inside of Sling. This interface is implemented in the <TT>scripting/resolver</TT> bundle in the <TT>DefaultSlingScript</TT> class which also implements the <TT>javax.servlet.Servlet</TT>.</P>
+
+<P>To further simplify the access to scripts from the Resource tree, the <TT>scripting/resolver</TT> bundle registers an <TT>AdapterFactory</TT> to adapt Resources to Scripts and Servlets. In fact the adapter factory returns instances of the <TT>DefaultSlingScript</TT> class for both Scripts and Servlets.</P>
+
+<P>This functionality is used by the <TT>ServletResolver.resolveServlet</TT> implementation in the <TT>sling/servlet-resolver</TT> 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 <TT>javax.servlet.Servlet</TT> 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><A name="ServletResolution-ResolutionProcess"></A>Resolution Process</H2>
+
+<P>The Servlet Resolution Process four elements of a <TT>SlingHttpServletRequest</TT>:</P>
+
+<OL>
+	<LI>The <EM>resource type</EM> as retrieved through <TT>request.getResource().getResourceType()</TT>. 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 <TT>request.getRequestPathInfo().getSelectorString()</TT>. The selector string is turned into a realtive path by replacing all separating dots by forward slashes. For example the selector string <TT>print.a4</TT> is  converted into the relative path <TT>print/a4</TT>.</LI>
+	<LI>The <EM>request extension</EM> as retrieved through <TT>request.getRequestPathInfo().getExtension()</TT> 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 <TT>ResourceResolver.getResource(String)</TT> 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="code panel" style="border-width: 1px;"><DIV class="codeContent panelContent">
+<PRE class="code-java">
+Servlet resolveServlet(SlingHttpServletRequest request) {
+
+    <SPAN class="code-object">String</SPAN> resourceType = request.getResource().getResourceType();
+    resourceType = resourceType.replaceAll(<SPAN class="code-quote">&quot;\\:&quot;</SPAN>, <SPAN class="code-quote">&quot;/&quot;</SPAN>);
+
+    <SPAN class="code-object">String</SPAN> baseName;
+    <SPAN class="code-keyword">if</SPAN> ((<SPAN class="code-quote">&quot;GET&quot;</SPAN>.equals(request.getMethod()) || <SPAN class="code-quote">&quot;HEAD&quot;</SPAN>.equals(request.getMethod())
+            &amp;&amp; request.getRequestPathInfo().getExtension() != <SPAN class="code-keyword">null</SPAN>) {
+        baseName = request.getRequestPathInfo().getExtension();
+    } <SPAN class="code-keyword">else</SPAN> {
+        baseName = request.getMethod();
+    }
+
+    <SPAN class="code-keyword">if</SPAN> (request.getRequestPath().getSelectorString() != <SPAN class="code-keyword">null</SPAN>) {
+        <SPAN class="code-object">String</SPAN> selectors = request.getRequestPath().getSelectorString();
+        selectors = selectors.replace('.', '/');
+        <SPAN class="code-keyword">while</SPAN> (selectors != <SPAN class="code-keyword">null</SPAN>) {
+            <SPAN class="code-object">String</SPAN> path = resourceType + <SPAN class="code-quote">&quot;/&quot;</SPAN> + selectors + <SPAN class="code-quote">&quot;/&quot;</SPAN> + baseName;
+            Servlet servlet = findServletFor(path);
+            <SPAN class="code-keyword">if</SPAN> (servlet != <SPAN class="code-keyword">null</SPAN>) {
+                <SPAN class="code-keyword">return</SPAN> servlet;
+            }
+
+            <SPAN class="code-object">int</SPAN> lastSlash = selectors.lastIndexOf('/');
+            <SPAN class="code-keyword">if</SPAN> (lastSlash &gt; 0) {
+                selectors = selectors.substring(0, lastSlash);
+            } <SPAN class="code-keyword">else</SPAN> {
+                selectors = <SPAN class="code-keyword">null</SPAN>;
+            }
+        }
+    }
+        
+    <SPAN class="code-object">String</SPAN> path = resourceType + <SPAN class="code-quote">&quot;/&quot;</SPAN> + baseName;
+    <SPAN class="code-keyword">return</SPAN> findScriptFor(path);
+}
+
+Servlet findScriptFor(path) {
+    <SPAN class="code-comment">// Find a Servlet or Script with the given path in the search path
+</SPAN>    <SPAN class="code-comment">// where the Script is allowed to have Script language specific
+</SPAN>    <SPAN class="code-comment">// extension, such as .js, .jsp, etc.
+</SPAN>}
+</PRE>
+</DIV></DIV>
+
+
+<H2><A name="ServletResolution-DefaultServlet%28s%29"></A>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 <TT>sling/servlet/default</TT>.</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 <TT>sling/servlet-resolve</TT> bundle provides a fall back <TT>DefaultServlet</TT> with the following functionality:</P>
+
+<UL>
+	<LI>If the request has no extension and the Resource of the request adapts to an <TT>InputStream</TT>, the contents of the resoure is stream out as the response. The response content type is taken from the <TT>sling.contentType</TT> Resource meta data or derived from the Resource path. If the <TT>sling.characterEncoding</TT> 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><A name="ServletResolution-ErrorHandlerServlet%28s%29"></A>Error Handler Servlet(s)</H2>
+
+<P>The <TT>sling/servlet-resolver</TT> project also provides an implementation of the Sling Core <TT>ErrorHandler</TT> 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 <TT>sling/servlet/errorhandler</TT> and an error specific name:</P>
+
+<UL>
+	<LI><B>HTTP Status Code Handling</B>: To handle HTTP status code as used by the <TT>HttpServletResponse.sendError</TT> 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 <TT>prefix/sling/servlet/errorhandler/404.esp</TT> or for a status code 500 (INTERNAL_SERVER_ERRROR), you might want to register a Servlet at <TT>prefix/sling/servlet/errorhandler/500</TT>.</LI>
+	<LI><B>Throwable Handling</B>: To handle uncaught <TT>Throwables</TT> the simple name of the <TT>Throwable</TT> class is used as the Servlet name. Similarly to the Java <TT>try-catch</TT> clauses the class hierarchy is supported. That is to handle an uncaught <TT>FileNotFoundException</TT>, the names <TT>FileNotFoundException</TT>, <TT>IOException</TT>, <TT>Exception</TT>, <TT>Throwable</TT> 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><A name="ServletResolution-Integrationtests"></A>Integration tests</H2>
+<P>A set of simple example servlets is available in the <A href="http://svn.apache.org/repos/asf/incubator/sling/trunk/launchpad/test-services" class="external-link" rel="nofollow">launchpad/test-services module</A>. </P>
+
+<P>Integration tests in the <A href="http://svn.apache.org/repos/asf/incubator/sling/trunk/launchpad/testing/src/test/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution" class="external-link" rel="nofollow">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;">
+Last modified by mykee on 2009-08-05 13:35:11.0
+        </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