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 [25/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/servlets.html
==============================================================================
--- websites/staging/sling/trunk/content/site/servlets.html (added)
+++ websites/staging/sling/trunk/content/site/servlets.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,204 @@
+
+<!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 - Servlets</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="the-sling-engine.html" title="The Sling Engine">The Sling Engine</A>&nbsp;&gt;&nbsp;<A href="" title="Servlets">Servlets</A>
+        </DIV>
+<H1><A name="Servlets-ServletsandScripts"></A>Servlets and Scripts</H1>
+
+<P>Servlets can be registered as OSGi services. 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. <BR>
+A servlet using this property might be ignored unless its path is included in the <EM>Execution Paths</EM> (<TT>servletresolver.paths</TT>) configuration setting of the <TT>SlingServletResolver</TT> service.<BR>
+Creating a resource at the desired path, with a resource type that maps to a servlet, provides the same result in most cases while taking advantage of more Sling built-in features.</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 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. If this property is missing, the value defaults to GET, regardless of which methods are actually implemented/handled by the servlet.</TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>sling.servlet.prefix</TT> </TD>
+<TD class="confluenceTd"> The prefix or numeric index to make relative paths absolute. If the value of this property is a number (int), it defines the index of the search path entries from the resource resolver to be used as the prefix. The defined search path is used as a prefix to mount this servlet. The number can be -1 which always points to the last search entry. If the specified value is higher than than the highest index of the search paths, the last entry is used. The index starts with 0. If the value of this property is a string and parseable as a number, the value is treated as if it would be a number. If the value of this property is a string starting with &quot;/&quot;, this value is applied as a prefix, regardless of the configured search paths! If the value is anything else, it is ignored. If this property is not specified, it defaults to the default configuration of the sling servlet resolver. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<P>A <TT>SlingServletResolver</TT> listens for <TT>Servlet</TT>services and - given the correct service registration properties - provides the servlets as resources in the (virtual) resource tree. Such servlets are provided as <TT>ServletResource</TT> instances which adapt to the <TT>javax.servlet.Servlet</TT> class.</P>
+
+<P>For a Servlet registered as an OSGi service to be used by the Sling Servlet Resolver, the either or both of the <TT>sling.servlet.paths</TT> or the <TT>sling.servlet.resourceTypes</TT> service reference properties must be set. If neither is set, the Servlet service is ignored.</P>
+
+<P>Each path to be used for registration - either from the <TT>sling.servlet.paths</TT> property or constructed from the other <TT>sling.servlet.&#42;</TT> properties - 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 - <TT>/</TT> &#45; is used as the prefix.</P>
+
+<P>If <TT>sling.servlet.methods</TT> is not specified, the servlet is only registered for handling GET requests. Make sure to list all methods you want to be handled by this servlet.</P>
+
+<H3><A name="Servlets-Automatedtests"></A>Automated tests</H3>
+<P>The <A href="http://svn.apache.org/repos/asf/sling/trunk/launchpad/test-services/" class="external-link" rel="nofollow">launchpad/test-services</A> module contains test servlets that use various combinations of the above properties. </P>
+
+<P>The <A href="http://svn.apache.org/repos/asf/sling/trunk/launchpad/integration-tests/" class="external-link" rel="nofollow">launchpad/integration-tests</A> module contains a number of tests (like the <A href="http://svn.apache.org/repos/asf/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/ExtensionServletTest.java" class="external-link" rel="nofollow">ExtensionServletTest</A> for example) that verify the results.</P>
+
+<P>Such tests run as part of our continuous integration process, to demonstrate and verify the behavior of the various servlet registration mechanisms, in a way that's guaranteed to be in sync with the actual Sling core code. If you have an idea for additional tests, make sure to let us know!</P>
+
+<H3><A name="Servlets-Example%3ARegistrationbyPath"></A>Example: Registration by Path</H3>
+
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>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; \]
+</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> <B>are ignored</B> because the <TT>sling.servlet.paths</TT> property is set.</P>
+
+
+<H3><A name="Servlets-Example%3ARegistrationbyResourceTypeetc."></A>Example: Registration by Resource Type etc.</H3>
+
+<DIV class="preformatted panel" style="border-width: 1px;"><DIV class="preformattedContent panelContent">
+<PRE>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; \]
+</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 Servlet 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="Servlets-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/core</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/core</TT> bundle registers an <TT>AdapterFactory</TT> to adapt Resources to Scripts and Servlets (the <TT>SlingScriptAdapterFactory</TT>). In fact the adapter factory returns instances of the <TT>DefaultSlingScript</TT> class for both Scripts and Servlets.</P>
+
+<P>From the perspective of the Servlet resolver, scripts and servlets are handled exactly the same. In fact, internally, Sling only handles with Servlets, whereas scripts are packed inside a Servlet wrapping and representing the script.</P>
+
+
+<H2><A name="Servlets-"></A></H2>
+
+
+<H2><A name="Servlets-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 (or script) 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 or it may be a Script stored in the repository or provided by any bundle.</P>
+
+<P>Finally, if not even a registered default Servlet may be resolved for the request, because none has been registered, the <TT>servlets/resolver</TT> bundle provides a fall back the <TT>DefaultServlet</TT> with the following functionality:</P>
+
+<UL>
+	<LI>If an <TT>NonExistingResource</TT> was created for the request the <TT>DefaultServlet</TT> sends a 404 (Not Found)</LI>
+	<LI>Otherwise the <TT>DefaultServlet</TT> sends a 500 (Internal Server Error), because normally at least a <TT>NonExistingResource</TT> should be created</LI>
+</UL>
+
+
+<H2><A name="Servlets-OptingServletinterface"></A>OptingServlet interface</H2>
+<P>If a registered servlet implements the OptingServlet interface, Sling uses that servlet's <TT>accepts(SlingHttpServletRequest request)</TT> method to refine the servlet resolution process.</P>
+
+<P>In this case, the servlet is only selected for processing the current request if its <TT>accept</TT> method returns true.</P>
+
+
+<H2><A name="Servlets-ErrorHandlerServlet%28s%29orScripts"></A>Error Handler Servlet(s) or Scripts</H2>
+
+<P>Error handling support is now described on the <A href="errorhandling.html" title="Errorhandling">Errorhandling</A> page.</P>
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by bdelacretaz on Thu May 10 15:11:36 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/sling-api-redesign.html
==============================================================================
--- websites/staging/sling/trunk/content/site/sling-api-redesign.html (added)
+++ websites/staging/sling/trunk/content/site/sling-api-redesign.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,267 @@
+
+<!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 - Sling API Redesign</TITLE>
+    <LINK rel="stylesheet" href="http://incubator.apache.org/sling/site/media.data/site.css" type="text/css" media="all">
+    <LINK rel="icon" href="http://incubator.apache.org/sling/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://incubator.apache.org/sling/site/index.html">
+          <IMG border="0" alt="Apache Sling" src="http://incubator.apache.org/sling/site/media.data/logo.png">
+        </A>
+      </DIV>
+      <DIV class="header">
+        <A href="http://incubator.apache.org/">
+          <IMG border="0" alt="Apache Incubator" src="http://incubator.apache.org/images/apache-incubator-logo.png">
+        </A>
+      </DIV>
+    </DIV>
+    <DIV class="menu">
+                                    <P>
+
+<UL>
+	<LI><A href="index.html" title="Index">Home</A></LI>
+	<LI><A href="project-information.html" title="Project Information">Project Information</A></LI>
+	<LI><A href="usecases.html" title="UseCases">Use Cases</A></LI>
+	<LI><A href="guides.html" title="Guides">Guides</A></LI>
+	<LI><A href="documentation.html" title="Documentation">Documentation</A></LI>
+	<LI><A href="plugins.html" title="Plugins">Plugins</A></LI>
+	<LI><A href="faq.html" title="FAQ">FAQ</A></LI>
+	<LI><A href="links.html" title="Links">Links</A></LI>
+	<LI><A href="old-documentation.html" title="Old Documentation">Old Documentation</A></LI>
+	<LI><SPAN class="nobr"><A href="http://cwiki.apache.org/confluence/x/GAUB" title="Visit page outside Confluence" rel="nofollow">Wiki<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/thanks.html" title="Visit page outside Confluence" rel="nofollow">Sponsors<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://www.apache.org/foundation/sponsorship.html" title="Visit page outside Confluence" rel="nofollow">Sponsorship<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+</UL>
+
+
+<P>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </DIV>
+    <DIV class="main">
+<H1><A name="SlingAPIRedesign-RedesignoftheSlingAPI"></A>Redesign of the Sling API</H1>
+
+<P>There have been a number of threads on the Sling Dev Mailing List on simplifying the current <EM>Component API</EM> and turn it into a new Sling API. This page starts at the current state of the discussion as of Oct. 10, 2007, and tries to summarize what has been discussed and to resolve this into a modified proposal.</P>
+
+<DIV>[ <A href="#SlingAPIRedesign-RedesignoftheSlingAPI">Redesign of the Sling API</A> ] [ <A href="#SlingAPIRedesign-References">References</A> ] [ <A href="#SlingAPIRedesign-CurrentState">Current State</A> ] [ <A href="#SlingAPIRedesign-UpdateModified%257B%257BContent%257D%257D">Update Modified <TT>Content</TT></A> ] [ <A href="#SlingAPIRedesign-JCRbasedOperations">JCR based Operations</A> ] [ <A href="#SlingAPIRedesign-Replace%257B%257BContent%257D%257Dby%257B%257BResource%257D%257D">Replace <TT>Content</TT> by <TT>Resource</TT></A> ] [ <A href="#SlingAPIRedesign-Extensionstothe%257B%257BResource%257D%257Dinterface">Extensions to the <TT>Resource</TT> interface</A> ] [ <A href="#SlingAPIRedesign-OpenIssues">Open Issues</A> ] [ <A href="#SlingAPIRedesign-ResolvingtheServlet">Resolving the Servlet</A> ]</DIV>
+
+
+<H2><A name="SlingAPIRedesign-References"></A>References</H2>
+
+<UL>
+	<LI><SPAN class="nobr"><A href="http://issues.apache.org/jira/browse/SLING-28" title="Visit page outside Confluence" rel="nofollow">SLING-28, Simplify the Sling (aka Component) API<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN></LI>
+	<LI><SPAN class="nobr"><A href="http://issues.apache.org/jira/browse/SLING-47" title="Visit page outside Confluence" rel="nofollow">SLING-47, microsling<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN>, &quot;Sling reduced to the max&quot;</LI>
+	<LI><SPAN class="nobr"><A href="http://www.mail-archive.com/sling-dev@incubator.apache.org/msg00177.html" title="Visit page outside Confluence" rel="nofollow">Simplifying our component api<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN> - The original thread launched by Carsten</LI>
+	<LI><SPAN class="nobr"><A href="http://www.mail-archive.com/sling-dev@incubator.apache.org/msg00267.html" title="Visit page outside Confluence" rel="nofollow">Move ContentManager to Sling API<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN> - My own proposal to make the ContentManager part of the Sling API</LI>
+	<LI><SPAN class="nobr"><A href="http://www.mail-archive.com/sling-dev@incubator.apache.org/msg00288.html" title="Visit page outside Confluence" rel="nofollow">Breaking Sling into smaller pieces?<SUP><IMG class="rendericon" src="http://cwiki.apache.org/confluence/images/icons/linkext7.gif" height="7" width="7" align="absmiddle" alt="" border="0"></SUP></A></SPAN> - Bertrand's proposal to further modularize parts of Sling such as the current <EM>sling-core</EM> bundle</LI>
+</UL>
+
+
+
+
+<H2><A name="SlingAPIRedesign-CurrentState"></A>Current State</H2>
+
+<P>Currently, request processing is controlled by the <EM>sling-core</EM> bundle using two sets of filters: one set called at the time the client request enters Sling - so called request level filters - and the other set called for each Content object processed during request processing - so called content level filters.</P>
+
+<P>Amongst the request level filters is the <TT>ContentResolverFilter</TT> which takes the request URL and finds a <TT>Content</TT> object for the URL. This filter implements the <TT>ContentResolver</TT> interface and is also registered as this service. So other parts of the system may use the same mechanism to resolve paths to <TT>Content</TT> objects. The <TT>ContentResolver</TT> also implements the default content loading described <A href="default-mapping-and-rendering.html" title="Default Mapping and Rendering">here</A>.</P>
+
+<P>Amongst the content level filters is the <TT>ComponentResolverFilter</TT> which asks the <TT>Content</TT> object for its component ID and resolves this ID using the registered {{Component}}s. This filter also implements the default component resolution described <A href="default-mapping-and-rendering.html" title="Default Mapping and Rendering">here</A>.</P>
+
+<P>To manage content Sling provides two interfaces:</P>
+
+<UL>
+	<LI><B><TT>ContentManager</TT></B> - Basic interface allowing CRUD operations using <TT>Content</TT> objects. This interface is completely agnostic of the actual persistence used.</LI>
+	<LI><B><TT>JcrContentManager</TT></B> - Extends the <TT>ContentManager</TT> interface integrating with the Jackrabbit OCM <TT>ObjectContentManager</TT> interface. This provides the API actually used by the <TT>ContentResolverFilter</TT> to load <TT>Content</TT> objects from the JCR repository according to the request URL.</LI>
+</UL>
+
+
+
+<P>If components would want to create, update and delete content, they would access the <TT>ContentManager</TT> by retrieving the <TT>org.apache.sling.jcr.content_manager</TT> request attribute. If JCR tasks would have to be executed, that retrieved object would be cast to <TT>JcrContentManager</TT> and the session retrieved.</P>
+
+<P>Examples:</P>
+
+<H5><A name="SlingAPIRedesign-UpdateModified%7B%7BContent%7D%7D"></A>Update Modified <TT>Content</TT></H5>
+
+<P>After having modified the content, a component might do the following to persisted the modified content:</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java">Content content = componentRequest.getContent();
+
+<SPAN class="code-comment">// modify content
+</SPAN>
+ContentManager contentManager = (ContentManager) componentRequest.getAttribute(<SPAN class="code-quote">&quot;org.apache.sling.jcr.content_manager&quot;</SPAN>);
+contentManager.store(content);
+contentManager.save();</PRE>
+</DIV></DIV>
+
+
+<H5><A name="SlingAPIRedesign-JCRbasedOperations"></A>JCR based Operations</H5>
+
+<P>To operate on a JCR level or to directly access the JCR <TT>Node</TT> underlying the request <TT>Content</TT> the following might be done:</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-comment">// get the JCR content manager
+</SPAN>JcrContentManager jcrContentManager = (JcrContentManager) componentRequest.getAttribute(<SPAN class="code-quote">&quot;org.apache.sling.jcr.content_manager&quot;</SPAN>);
+
+<SPAN class="code-comment">// get the session
+</SPAN>Session session = jcrContentManager.getSession();
+
+<SPAN class="code-comment">// access the node addressed by the request URL
+</SPAN><SPAN class="code-object">String</SPAN> contentPath = componentRequest.getContent().getPath();
+Node contentNode = (Node) session.getItem(contentPath);</PRE>
+</DIV></DIV>
+
+
+<P>Arguably, this is tedious. So a first simplification proposal suggested to move the JCR agnostic <TT>ContentManager</TT> interface to the Sling API and to provide a getter method on the <TT>ComponentRequest</TT> interface. The returned object might also be cast to a <TT>JcrContentManager</TT> to then access the repository.</P>
+
+<P>This proposal sparked a series of reactions (see references above) and so based on Bertrands thoughts, we propose the following change.</P>
+
+
+
+<H2><A name="SlingAPIRedesign-Replace%7B%7BContent%7D%7Dby%7B%7BResource%7D%7D"></A>Replace <TT>Content</TT> by <TT>Resource</TT></H2>
+
+<P>The &quot;problem&quot; of the current Component API is that is centered around a <TT>Content</TT> interface which presumably is data provided to the component loaded from the persistence (the JCR repository of course) actually hiding the repository. This also predefines how data is acquired and used, namely by using Object Content Mapping.</P>
+
+<P>Starting off this situation, we propose replacing the (fully loaded) <TT>Content</TT> by a data representation we will call <TT>Resource</TT>:</P>
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> Resource {
+
+  <SPAN class="code-comment">// the original request URL leading to the resource
+</SPAN>  <SPAN class="code-comment">// <SPAN class="code-keyword">this</SPAN> is not necessairily the same as ServletRequest.getRequestURL as
+</SPAN>  <SPAN class="code-comment">// it may have been processed by some URL mapping and folding
+</SPAN>  <SPAN class="code-object">String</SPAN> getOriginalURI();
+
+  <SPAN class="code-comment">// the path to the actual resource providing the data
+</SPAN>  <SPAN class="code-comment">// from the point of view of Sling <SPAN class="code-keyword">this</SPAN> is just a string
+</SPAN>  <SPAN class="code-object">String</SPAN> getURI();
+
+  <SPAN class="code-comment">// the selectors of the request or empty array <SPAN class="code-keyword">if</SPAN> none
+</SPAN>  <SPAN class="code-comment">// the selectors are dot-separated strings after the part of
+</SPAN>  <SPAN class="code-comment">// original URI addressing the resource upto the extension
+</SPAN>  <SPAN class="code-comment">// Examples:
+</SPAN>  <SPAN class="code-comment">//    - /a/b/c has no selectors <SPAN class="code-keyword">for</SPAN> resource /a/b/c
+</SPAN>  <SPAN class="code-comment">//    - /a/b/c.html has no selectors <SPAN class="code-keyword">for</SPAN> resource /a/b/c
+</SPAN>  <SPAN class="code-comment">//    - /a/b/c.s1.s2.html has selectors [ s1, s2 ] <SPAN class="code-keyword">for</SPAN> resource /a/b/c
+</SPAN>  <SPAN class="code-comment">//    - /a/b/c.s.html/suffix has selector [ s ] <SPAN class="code-keyword">for</SPAN> resource /a/b/c
+</SPAN>  <SPAN class="code-object">String</SPAN>[] getSelectors();
+
+  <SPAN class="code-comment">// the extension of the request or empty string <SPAN class="code-keyword">if</SPAN> none
+</SPAN>  <SPAN class="code-comment">// the extension is a string after the last dot after the
+</SPAN>  <SPAN class="code-comment">// part of the original URI addressing the resource upto the
+</SPAN>  <SPAN class="code-comment">// end of the original URI or a slash
+</SPAN>  <SPAN class="code-comment">// Examples:
+</SPAN>  <SPAN class="code-comment">//    - /a/b/c has no extension <SPAN class="code-keyword">for</SPAN> resource /a/b/c
+</SPAN>  <SPAN class="code-comment">//    - /a/b/c.html has extension html <SPAN class="code-keyword">for</SPAN> resource /a/b/c
+</SPAN>  <SPAN class="code-comment">//    - /a/b/c.s1.s2.html has extension html <SPAN class="code-keyword">for</SPAN> resource /a/b/c
+</SPAN>  <SPAN class="code-comment">//    - /a/b/c.s.html/suffix has extension html <SPAN class="code-keyword">for</SPAN> resource /a/b/c
+</SPAN>  <SPAN class="code-object">String</SPAN> getExtension();
+
+  <SPAN class="code-comment">// the suffix of the request or empty string <SPAN class="code-keyword">if</SPAN> none
+</SPAN>  <SPAN class="code-comment">// the suffix is the string after the next slash after the part
+</SPAN>  <SPAN class="code-comment">// of the original URI addressing the resource
+</SPAN>  <SPAN class="code-comment">// Examples:
+</SPAN>  <SPAN class="code-comment">//    - /a/b/c has no suffix <SPAN class="code-keyword">for</SPAN> resource /a/b/c
+</SPAN>  <SPAN class="code-comment">//    - /a/b/c.html has no suffix <SPAN class="code-keyword">for</SPAN> resource /a/b/c
+</SPAN>  <SPAN class="code-comment">//    - /a/b/c.s1.s2.html has no suffix <SPAN class="code-keyword">for</SPAN> resource /a/b/c
+</SPAN>  <SPAN class="code-comment">//    - /a/b/c.s.html/suffix has suffix suffix <SPAN class="code-keyword">for</SPAN> resource /a/b/c
+</SPAN>  <SPAN class="code-object">String</SPAN> getSuffix();
+
+}</PRE>
+</DIV></DIV>
+
+<P>The <TT>ComponentRequest</TT> interface would be modified as follows:</P>
+
+<UL>
+	<LI>The <TT>getExtension()</TT>, <TT>getSelector(int)</TT>, <TT>getSelectors()</TT>, <TT>getSelectorString()</TT> and <TT>getSuffix()</TT> methods are removed as this information can now be obtained from the <TT>Resource</TT> directly.</LI>
+	<LI>The <TT>getContent()</TT>, <TT>getContent(String)</TT>, <TT>getChildren(Content)</TT> and <TT>getRequestDispatcher(Content)</TT> methods are replaced as follows:</LI>
+</UL>
+
+
+<DIV class="code"><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> ComponentRequest <SPAN class="code-keyword">extends</SPAN> HttpServletRequest {
+
+  ...
+
+  <SPAN class="code-comment">// Returns the Resource to which the getRequestURL method maps
+</SPAN>  Resource getResource();
+
+  <SPAN class="code-comment">// Returns a Resource to which the given URI <SPAN class="code-object">String</SPAN> maps
+</SPAN>  <SPAN class="code-comment">// Implicit: getResource().equals(getResource(getRequestURL()))
+</SPAN>  Resource getResource(<SPAN class="code-object">String</SPAN> uri);
+
+  <SPAN class="code-comment">// Returns an Enumeration child Resources of the given Resource
+</SPAN>  <SPAN class="code-comment">// If resource parameter is <SPAN class="code-keyword">null</SPAN>, getResource() is used as parent
+</SPAN>  <SPAN class="code-comment">// (use Enumeration to stay in line with the HttpServletRequest)
+</SPAN>  Enumeration&lt;Resource&gt; getChildren(Resource resource);
+
+  <SPAN class="code-comment">// Gets a RequestDispatcher to include the given resource
+</SPAN>  RequestDispatcher getRequestDispatcher(Resource resource);
+
+  ...
+
+}</PRE>
+</DIV></DIV>
+
+
+<H3><A name="SlingAPIRedesign-Extensionstothe%7B%7BResource%7D%7Dinterface"></A>Extensions to the <TT>Resource</TT> interface</H3>
+
+<P>The <TT>Resource</TT> interface may be extended depending on the way, the resource is acquired. For example, there might be a <TT>MappedContentResource</TT> which would return an object mapped from any persistence layer, a <TT>JcrResource</TT> may encapsulate a JCR based resource. A resolver loading content from a JCR repository using Jackrabbit OCM might return a resource which implements both the <TT>MappedContentResource</TT> and the <TT>JcrResource</TT> interfaces.</P>
+
+<DIV class="code"><DIV class="codeHeader"><B>MappedContentResource</B></DIV><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> MappedContentResource <SPAN class="code-keyword">extends</SPAN> Resource {
+
+  <SPAN class="code-comment">// Returns the mapped data object
+</SPAN>  <SPAN class="code-object">Object</SPAN> getObject();
+
+}</PRE>
+</DIV></DIV>
+
+<DIV class="code"><DIV class="codeHeader"><B>JcrResource</B></DIV><DIV class="codeContent">
+<PRE class="code-java"><SPAN class="code-keyword">public</SPAN> <SPAN class="code-keyword">interface</SPAN> JcrResource <SPAN class="code-keyword">extends</SPAN> Resource {
+
+  <SPAN class="code-comment">// Returns the JCR session used to acquire the Node
+</SPAN>  <SPAN class="code-comment">// (<SPAN class="code-keyword">this</SPAN> is actually convenience as getNode().getSession()
+</SPAN>  <SPAN class="code-comment">// must <SPAN class="code-keyword">return</SPAN> the same session)
+</SPAN>  Session getSession();
+
+  <SPAN class="code-comment">// Returns the JCR Node addressed by the Resource URI
+</SPAN>  <SPAN class="code-comment">// <SPAN class="code-keyword">this</SPAN> is the same as getSession().getItem(getURI());
+</SPAN>  Node getNode();
+
+}</PRE>
+</DIV></DIV>
+
+
+<P>The existing ContentResolver will be retargeted to the <TT>Resource</TT> interface and return an object implementing the <TT>MappedContentResource</TT> and the <TT>JcrResource</TT> interfaces if a mapping exists. Otherwise an object just implementing the <TT>JcrResource</TT> interface is returned providing just the resolved node.</P>
+
+
+<H2><A name="SlingAPIRedesign-OpenIssues"></A>Open Issues</H2>
+
+<P>This above definition leaves a series of issues open.</P>
+
+
+<H3><A name="SlingAPIRedesign-ResolvingtheServlet"></A>Resolving the Servlet</H3>
+
+<TABLE cellpadding="5" width="85%" cellspacing="8px" class="infoMacro" border="0" align="center"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="http://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD>
+<P>The <TT>Component</TT> interface is removed and the <TT>Servlet</TT> interface is used.</P></TD></TR></TABLE>
+
+<P>Currently the <TT>Content</TT> interface defines a method <TT>getComponentId()</TT> which returns the identifier of a <TT>Component</TT> to which processing of the request is dispatched. With the new <TT>Resource</TT> interface, no such method exists any more.</P>
+
+<P>The intent is, that <TT>Servlet</TT> resolver would know about the concrete implementations of the <TT>Resource</TT> interface and could handle the respective resources. For example the Sling standard servlet resolver could try the following:</P>
+
+<OL>
+	<LI>If the <TT>Resource</TT> is a <TT>JcrResource</TT> check the <TT>sling:servletId</TT> property of the resource node. If such a property exists and denotes a registered <TT>Servlet</TT> service, that servlet is used.</LI>
+	<LI>Otherwise, if the <TT>Resource</TT> is a <TT>MappedContentResource</TT>, find a <TT>Servlet</TT> service willing to handle requests for the actual object class of the mapped object. The <TT>Servlet</TT> service could be registered with a service property listing the names of the mapped object classes supported.</LI>
+	<LI>Otherwise try to find a registered <TT>Servlet</TT> interface willing to handle the request using the resource path, selectors and/or extensions.</LI>
+</OL>
+
+
+<P>Alternatively, the <TT>Resource</TT> interface might have a <TT>getServletId()</TT> method providing the identifier of the servlet to use. It might well be that the first solution is the better one.</P>
+    </DIV>
+  </BODY>
+</HTML>
+

Added: websites/staging/sling/trunk/content/site/sling-api.html
==============================================================================
--- websites/staging/sling/trunk/content/site/sling-api.html (added)
+++ websites/staging/sling/trunk/content/site/sling-api.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,466 @@
+
+<!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 - Sling API</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="Sling API">Sling API</A>
+        </DIV>
+<H1><A name="SlingAPI-TheSlingAPI"></A>The Sling API</H1>
+
+
+<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><B>Work In Progress</B><BR>The contents of this page is being created at the moment. It contains incomplete and partially wrong information as the text is adapted from the contents of the <A href="https://cwiki.apache.org/confluence/pages/createpage.action?spaceKey=SLINGxSITE&title=Component%20API&linkCreation=true&fromPageId=76172" class="createlink">Component API</A> documentation page.</TD></TR></TABLE></DIV>
+
+
+<H2><A name="SlingAPI-Introduction"></A>Introduction</H2>
+
+<P>The <EM>Sling API</EM> defines a presentation framework to build Web Applications. As such the Sling API builds upon the Servlet API but extends the latter with new functionality:</P>
+
+<UL>
+	<LI>A web page may be built from many different pieces. This aggregation of different pieces is comparable to the functionality provided by the Portlet API. In contrast to the latter, though, the pieces may themselves be aggregates of yet more pieces. So a single web page response may consist of a tree of pieces.</LI>
+	<LI>Just like the Servlet API and the Portlet API the Sling API mainly defines a Java based framework. Yet the Sling API comes with the intention of supporting scripting built.</LI>
+	<LI>In contrast to the Servlet API and the Portlet API, the Sling API is resource centric. That is, the request URL does not address a servlet or a portlet but a resource represented by an instance of the <TT>org.apache.sling.api.resource.Resource</TT> interface. From this resource the implementation of the Sling API will derive a <TT>javax.servlet.Servlet</TT> or <TT>org.apache.sling.api.scripting.SlingScript</TT> instance, which is used to handle the request.</LI>
+</UL>
+
+
+<P>An implementation of the presentation framework defined by the Sling API is called a <EM>Sling Framework</EM>. The Apache Sling project actually contains two implementations of this API: <EM>microsling</EM> and <EM>Sling</EM>. microsling (note the lowercase <EM>m</EM>) implements the same request processing mechanisms as <EM>Sling</EM> but is very hardcoded. It serves well as a rapid development environment as it is quickly set up, easy to handle and shows results very easily. Sling on the other hand is based on an OSGi framework and very flexible, allowing the extension of the system in various ways.</P>
+
+
+
+<H2><A name="SlingAPI-GoingResourceCentric"></A>Going Resource Centric</H2>
+
+<P>Traditional web applications are built around the notion of a traditional application which is converted into an application which may be used using a Web Browser. Web applications consist of a series of servlets and JSP scripts, which are called based on configuration in the web application deployment descriptor. Such applications are generally based on some internal database or some static filesystem content.</P>
+
+<P>The Sling API on the other hand looks more like a traditional web server from the outside, which delivers more or less static content. Thus, while the traditional web application uses the request URL to select a piece of code to execute, the Sling API uses the URL to select a resource to be delivered.</P>
+
+
+
+<H3><A name="SlingAPI-ComparsiontotheServletAPI"></A>Comparsion to the Servlet API</H3>
+
+<P>The Sling API builds upon the Servlet API. Generally a Sling Framework will run inside a Servlet Container and be manifested towards the Servlet Container as a single Servlet, which dispatches requests to the Servlets and Scripts depending on the request URLs.</P>
+
+<P>Response rendering may itself be a multi-step operation. Depending on the Servlets and Scripts, the rendering may include dispatching for child (or even foreign) Resources.</P>
+
+
+
+<H3><A name="SlingAPI-ComparisiontothePortletAPI"></A>Comparision to the Portlet API</H3>
+
+<P>Unlike the Portlet API, which defines one single level of portlet hierarchy - portlets are just pieces residing besides each other - the Sling API allows for hierarchic structuring of Resources and hence Servlet and Script renderings. To support this structuring, the Sling Framework does not control the rendering process of all elements on the page like the Portlet Container does for the portlets. Instead only the Resource addressed by the request URL is processed and it is left to the Servlet or Script rendering that Resource to dispatch other Resource/Servlet/Script tupels to add more data to the response.</P>
+
+
+<H3><A name="SlingAPI-ToIteratororToEnumeration"></A>To Iterator or To Enumeration</H3>
+
+<P>With the advent of the Java Collection framework in Java 2, the <TT>Enumeration</TT> has been superceded by the <TT>Iterator</TT>. So the natural choice for the Sling API for methods to return enumeratable collection of objects would have be to declare the use of <TT>Iterator</TT> instances. But because the Servlet API defines to use <TT>Enumeration</TT> instances, the Sling API will also declare the use of <TT>Enumeration</TT> instances for consistency with the Servlet API extended by the Sling API.</P>
+
+
+
+
+<H2><A name="SlingAPI-RequestProcessing"></A>Request Processing</H2>
+
+<P>Unlike traditional Servlet API request processing, a Sling API request is processed by the Sling Framework in three basic steps:</P>
+
+<OL>
+	<LI><B>Resource Resolution</B> - The Sling Framework derives a Resource instance from the client request URL. The details of how to resolve the Resource. One possible solution would be to map the request URL to a <A href="http://www.jcp.org/en/jsr/detail?id=170" class="external-link" rel="nofollow">Java Content Repository</A> Node and return a Resource representing that Node.</LI>
+	<LI><B>Servlet and Script Resolution</B> - From the Resource created in the first step, the Servlet or Script is resolved based on the type of the Resource. The resource type is a simple string, whose semantics is defined by the Sling Framework. One possible definition could be for the resource type to be the primary node type of the Node underlying the Resource.</LI>
+	<LI><B>Input Processing and Response Generation</B> -  After getting the Resource and the Servlet or Script, the <TT>service()</TT> method is called or the script is evaluated to process any user supplied input and send the response to the client. To structure the rendered response page, this method is responsible to include other resources. See <EM>Dispatching Requests</EM> below for details. See <EM>Error Handling</EM> below for a discussion on how exceptions and HTTP stati are handled.</LI>
+</OL>
+
+
+
+
+<H3><A name="SlingAPI-URLdecomposition"></A>URL decomposition</H3>
+
+<P>During the <EM>Resource Resolution</EM> step, the client request URL is decomposed into the following parts:</P>
+
+<OL>
+	<LI><B>Resource Path</B> -  The longest substring of the request URL resolving to a Resource such that the resource path is either the complete request URL or the next character in the request URL after the resource path is either a dot (<TT>.</TT>) or a slash (<TT>/</TT>).</LI>
+	<LI><B>Selectors</B> -  If the first character in the request URL after the resource path is a dot, the string after the dot upto but not including the last dot before the next slash character or the end of the request URL. If the resource path spans the complete request URL or if a slash follows the resource path in the request URL, no seletors exist. If only one dot follows the resource path before the end of the request URL or the next slash, no selectors exist.</LI>
+	<LI><B>Extension</B> -  The string after the last dot after the resource path in the request URL but before the end of the request URL or the next slash after the resource path in the request URL. If a slash follows the resource path in the request URL, the extension is empty.</LI>
+	<LI><B>Suffix Path</B> -  If the request URL contains a slash character after the resource path and optional selectors and extension, the path starting with the slash upto the end of the request URL is the suffix path. Otherwise, the suffix path is empty.</LI>
+</OL>
+
+
+<P><B>Examples</B>: Assume there is a Resource at <TT>/a/b</TT>, which has no children.</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> URI </TH>
+<TH class="confluenceTh"> Resource Path </TH>
+<TH class="confluenceTh"> Selectors </TH>
+<TH class="confluenceTh"> Extension </TH>
+<TH class="confluenceTh"> Suffix </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> /a/b                      </TD>
+<TD class="confluenceTd"> /a/b </TD>
+<TD class="confluenceTd"> null  </TD>
+<TD class="confluenceTd"> null </TD>
+<TD class="confluenceTd"> null       </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> /a/b.html                 </TD>
+<TD class="confluenceTd"> /a/b </TD>
+<TD class="confluenceTd"> null  </TD>
+<TD class="confluenceTd"> html </TD>
+<TD class="confluenceTd"> null       </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> /a/b.s1.html              </TD>
+<TD class="confluenceTd"> /a/b </TD>
+<TD class="confluenceTd"> s1    </TD>
+<TD class="confluenceTd"> html </TD>
+<TD class="confluenceTd"> null       </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> /a/b.s1.s2.html           </TD>
+<TD class="confluenceTd"> /a/b </TD>
+<TD class="confluenceTd"> s1.s2 </TD>
+<TD class="confluenceTd"> html </TD>
+<TD class="confluenceTd"> null       </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> /a/b/c/d                  </TD>
+<TD class="confluenceTd"> /a/b </TD>
+<TD class="confluenceTd"> null  </TD>
+<TD class="confluenceTd"> null </TD>
+<TD class="confluenceTd"> /c/d       </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> /a/b.html/c/d             </TD>
+<TD class="confluenceTd"> /a/b </TD>
+<TD class="confluenceTd"> null  </TD>
+<TD class="confluenceTd"> html </TD>
+<TD class="confluenceTd"> /c/d       </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> /a/b.s1.html/c/d          </TD>
+<TD class="confluenceTd"> /a/b </TD>
+<TD class="confluenceTd"> s1    </TD>
+<TD class="confluenceTd"> html </TD>
+<TD class="confluenceTd"> /c/d       </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> /a/b.s1.s2.html/c/d       </TD>
+<TD class="confluenceTd"> /a/b </TD>
+<TD class="confluenceTd"> s1.s2 </TD>
+<TD class="confluenceTd"> html </TD>
+<TD class="confluenceTd"> /c/d       </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> /a/b/c/d.s.txt            </TD>
+<TD class="confluenceTd"> /a/b </TD>
+<TD class="confluenceTd"> null  </TD>
+<TD class="confluenceTd"> null </TD>
+<TD class="confluenceTd"> /c/d.s.txt </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> /a/b.html/c/d.s.txt       </TD>
+<TD class="confluenceTd"> /a/b </TD>
+<TD class="confluenceTd"> null  </TD>
+<TD class="confluenceTd"> html </TD>
+<TD class="confluenceTd"> /c/d.s.txt </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> /a/b.s1.html/c/d.s.txt    </TD>
+<TD class="confluenceTd"> /a/b </TD>
+<TD class="confluenceTd"> s1    </TD>
+<TD class="confluenceTd"> html </TD>
+<TD class="confluenceTd"> /c/d.s.txt </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> /a/b.s1.s2.html/c/d.s.txt </TD>
+<TD class="confluenceTd"> /a/b </TD>
+<TD class="confluenceTd"> s1.s2 </TD>
+<TD class="confluenceTd"> html </TD>
+<TD class="confluenceTd"> /c/d.s.txt </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<DIV class="panelMacro"><TABLE class="infoMacro"><COLGROUP><COL width="24"><COL></COLGROUP><TR><TD valign="top"><IMG src="https://cwiki.apache.org/confluence/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></TD><TD><B>Automated tests and examples</B><BR>The <A href="http://svn.apache.org/repos/asf/sling/trunk/bundles/engine/src/test/java/org/apache/sling/engine/impl/request/SlingRequestPathInfoTest.java" class="external-link" rel="nofollow">SlingRequestPathInfoTest</A> demonstrates and tests this decomposition. Feel free to suggest additional tests that help clarify how this works!</TD></TR></TABLE></DIV>
+
+<H2><A name="SlingAPI-TheSlingHttpServletRequest"></A>The SlingHttpServletRequest</H2>
+
+<P>The <TT>org.apache.sling.api.SlingHttpServletRequest</TT> interface defines the basic data available from the client request to both action processing and response rendering. The <TT>SlingHttpServletRequest</TT> extends the <TT>javax.servlet.http.HTTPServletRequest</TT>.</P>
+
+<P>This section describes the data available from the <TT>SlingHttpServletRequest</TT>. For a complete and normative description of the methods, refer to the Sling API JavaDoc. The following information is represented for reference. In the case of differences between the following descriptions and the Sling API JavaDoc, the latter takes precedence.</P>
+
+<OL>
+	<LI><B>Resource access</B> - Resources may be accessed from the <TT>SlingHttpServletRequest</TT> object through the following methods: <TT>getResource()</TT>, <TT>getResourceResolver()</TT>.</LI>
+	<LI><B>Request URL information</B> - In addition to the standard <TT>HttpServletRequest</TT> information the <TT>SlingHttpServletRequest</TT> provides access to the selectors, extension and suffix through the <TT>getRequestPathInfo()</TT> method. Note that the Resource path is not directly available form the <TT>SlingHttpServletRequest</TT> object. Instead it is available through the <TT>Resource.getPath()</TT> method of the Resource object retrieved through <TT>SlingHttpServletRequest.getResource()</TT>.</LI>
+	<LI><B>Request Parameters</B> - To support user input submitted as <TT>multipart/form-data</TT> encoded POST parameters, the Sling API intrduces the <TT>RequestParameter</TT> interface allowing file uploads. Request parameters represented as <TT>RequestParameter</TT> objects are returned by the following methods: <TT>getRequestParameter(String name)</TT>, <TT>getRequestParameterMap()</TT>, <TT>getRequestParameters(String name)</TT>.</LI>
+	<LI><B>Request Dispatching</B> - In addition to standard Serlvet API request dispatching, the Sling API supports dispatching requests to render different Resources using <TT>RequestDispatcher</TT> objects returned by the methods: <TT>getRequestDispatcher(Resource resource)</TT> and <TT>getRequestDispatcher(Resource resource, RequestDispatcherOptions options)</TT>.</LI>
+	<LI><B>Miscellaneous</B> - Finally the ComponentRequest interface provides the following methods: <TT>getCookie(String name)</TT>, <TT>getRequestProgressTracker()</TT>, <TT>getResponseContentType()</TT>, <TT>getResponseContentTypes()</TT>, <TT>getResourceBundle(Locale locale)</TT>, <TT>getServiceLocator()</TT>.</LI>
+</OL>
+
+
+<P>The <TT>SlingHttpServletRequest</TT> objects are only valid during the time of request processing. Servlets and Scripts must not keep references for later use. As such, the <TT>SlingHttpServletRequest</TT> interface and its extensions are defined to not be thread safe.</P>
+
+<P><EM>A note on HTTP Sessions</EM>: The <TT>SlingHttpServletRequest</TT> extends the <TT>HttpSerlvetRequest</TT> and thus supports standard HTTP sessions. Be aware, though that Sessions are server side sessions and hence violate the sessionless principle of REST and therefore should be used with care. It is almost always possible to not use sessions.</P>
+
+
+<H2><A name="SlingAPI-TheSlingHttpServletResponse"></A>The SlingHttpServletResponse</H2>
+
+<P>The <TT>org.apache.sling.api.SlingHttpServletResponse</TT> interface extends the <TT>javax.servet.http.HttpServletResponse</TT> interface and is currently empty. It merely exists for symmetry with the <TT>SlingHttpServletRequest</TT>.</P>
+
+
+
+
+<H2><A name="SlingAPI-TheResource"></A>The Resource</H2>
+
+<P>The <TT>org.apache.sling.resource.Resource</TT> represents the data addressed by the request URL. Resources may also be retrieved through the <TT>org.apache.sling.api.resource.ResourceResolver</TT>. Usually this interface is not implemented by clients. In certain use cases we call <EM>synthetic Resource</EM> if may be usefull to define a simple object implementing the <TT>Resource</TT> interface. The Sling Framework does not care about the concrete implementation of the <TT>Resource</TT> interface and rather uses the defined methods to access required information. The interface defines the following methods:</P>
+
+<OL>
+	<LI><B>getResourceType()</B> - Returns the type of the resource. This resource type is used to resolve the Servlet or Script used to handle the request for the resource.</LI>
+	<LI><B>getPath()</B> - Returns the path derived from the client request URL which led to the creation of the Resource instance. See the <A href="#SlingAPI-URLdecompositionURLdecomposition">URL&#95;decomposition URL decomposition</A> section above for more information. It is not required, that the Resource path be a part of the original client request URL. The request URL may also have been mapped to some internal path.</LI>
+	<LI><B>getResourceMetadata()</B> - Returns meta data information about the resource in a <TT>ResourceMetadata</TT> object.</LI>
+	<LI><B>adaptTo(Class&lt;AdapterType&gt; type)</B> - Returns alternative representations of the Resource. The concrete supported classes to which the Resource may be adapted depends on the implementation. For example a Resource based on a JCR Node may support being adapted to the underlying Node, an <TT>InputStream</TT>, an <TT>URL</TT> or even to a mapped object through JCR Object Content Mapping.</LI>
+</OL>
+
+
+<HR>
+
+
+
+<H2><A name="SlingAPI-TheComponent"></A>The Component</H2>
+
+<P>The <TT>org.apache.sling.component.Component</TT> interface defines the API implemented to actually handle requests. As such the Component interface is comparable to the =javax.servlet.Servlet= interface. Like those other interfaces, the Component interface provides methods for life cycle management: <TT>init(ComponentContext context)</TT>, <TT>destroy()</TT>.</P>
+
+
+
+<H3><A name="SlingAPI-ProcessingtheRequest"></A>Processing the Request</H3>
+
+<P>The Component Framework calls the <TT>service(ComponentRequest request, ComponentResponse response)</TT> method of the Component to have the component process the request optionally processing user input, rendering the response and optionally dispatch to other Content/Component tuples to provide more response data.</P>
+
+
+
+<H3><A name="SlingAPI-ContentanditsComponent"></A>Content and its Component</H3>
+
+<P>The Content object and a Component form a pair, in which the Content object takes the passive part of providing data to the Component and the Component takes the active part of acting upon the Content object. As a consequence, there always exists a link between a given implementation of the Content interface and a given implementation of the Component interface.</P>
+
+<P>This link is manifested by the Component identifier available from the Content object through the <TT>Content.getComponentId()</TT> method on the one hand. On the other hand, the link is manifested by the <TT>getContentClassName()</TT> and <TT>createContentInstance()</TT> methods of the Component interface.</P>
+
+
+
+<H3><A name="SlingAPI-ComponentLifecylce"></A>Component Lifecylce</H3>
+
+<P>When a Component instance is created and added to the Component framework, the <TT>init(ComponentContext)</TT> method is called to prepare and initialize the Component. If this method terminates abnormally by throwing an exception, the Component is not used. The Component Framework implementation may try at a later time to recreate the Component, intialize it and use it. If the Component Framework tries to recreate the Component a new instance of the Component must be created to be initialized and used.</P>
+
+<P>When the Component has successfully been initialized, it may be referred to by Content objects. When a client request is to be processed, the Content object is resolved and the <TT>service</TT> method on the Component to which the Content object refers is called. The <TT>service</TT> method may - and generally will - be called simultaneously to handle different requests in different threads. As such, implementations of these methods must be thread safe.</P>
+
+<P>When the Component Framework decides to take a Component out of service, the <TT>destroy()</TT> method is called to give the Component a chance to cleanup any held resources. The destroy method must only be called by the Component Framework when no more request processing is using the Component, that is no thread may be in the <TT>service</TT> method of a Component to be destroyed. Irrespective of whether the destroy method terminated normally or abnormally, the Component will not be used again.</P>
+
+<P>The addition and removal of Components is at the discretion of the Component Framework. A Component may be loaded at framework start time or on demand and my be removed at any time. But only one single Component instance with the same Component identifier may be active at the same time within a single Component Framework instance.</P>
+
+
+
+<H3><A name="SlingAPI-TheComponentExtension"></A>The ComponentExtension</H3>
+
+<P>To enhance the core functionality of Components, each Component may have zero, one ore more Component Extensions attached. A Component Extensions is a Java object implementing the <TT>org.apache.sling.component.ComponentExtension</TT> interface. This interface just defines a <TT>getName()</TT> method to identify extensions.</P>
+
+<P>The concrete implementation as well as instantiation and management of Component Extensions is left to the Component Framework implementation with one restriction though: The extensions must be available to the Component at the time the <TT>init(ComponentContext)</TT> method is called may only be dropped after the <TT>destroy()</TT> method terminates.</P>
+
+<P>The Component interface defines two methods to access Extensions: The <TT>getExtensions()</TT> method returns a <TT>java.util.Enumeration</TT> of all ComponentExtension objects attached to the component. If no Component Extension are attached to the Component, an empty enumeration is returned. The <TT>getExtension(String name)</TT> returns the named Component Extension attached to the Component or <TT>null</TT> if no such Component Extension is attached to the Component.</P>
+
+<P>Component Frameworks are allowed to share Component Extension instances of the same name between different Component instances. Regardless of whether Component Extensions are shared or not, they must be thread safe, as any Component Extension may be used within the <TT>service</TT> method, which themselves may be called concurrently.</P>
+
+
+
+
+<H2><A name="SlingAPI-RequestProcessingFilters"></A>Request Processing Filters</H2>
+
+<P>Similar to the Servlet API providing filters for filtering requests and/or responses the Component API provides the <TT>org.apache.sling.component.ComponentFilter</TT> interface. The filters are called by a <TT>ComponentFilterChain</TT> and either handle the request, manipulate the request and/or response object and finally forward the request and response optionally wrapped to the <TT>ComponentFilterChain.doFilter(ComponentRequest, ComponentResponse)</TT> method.</P>
+
+<P>Like the <TT>Component}}s  filters have a defined lifecycle manifested by {{init</TT> and <TT>destroy</TT> methods. When the filter enters the system, the Component Framework calls the <TT>ComponentFilter.init(ComponentContext)</TT> method. Only when this method completes successfully will the filter be put into action and be used during request processing. When the filter leaves the system, the Component Framework removes the filter from being used in filter chains and calls the <TT>ComponentFilter.destroy()</TT> method. This method is not expected to throw any exceptions. The filter may be removed from the Component Framework at the discretion of the Component Framework or because the filter is being unregistered from the Component Framework by some means outside this specification.</P>
+
+<P>This specification does not define how <TT>ComponentFilter</TT> objects are registered with the Component Framework nor is it specified how the order in which the filters are called is defined. Likewise it is outside this specification how the filter instances registered with the Component Framework are configured.</P>
+
+
+
+<H2><A name="SlingAPI-Sessions"></A>Sessions</H2>
+
+
+<P>The <TT>org.apache.sling.component.ComponentSession</TT> interface provides a way to identify a user across more than one request and to store transient information about that user.</P>
+
+<P>A component can bind an object attribute into a <TT>ComponentSession</TT> by name. The <TT>ComponentSession</TT> interface defines two scopes for storing objects: <TT>APPLICATION_SCOPE</TT>, <TT>COMPONENT_SCOPE</TT>. All objects stored in the session using the <TT>APPLICATION_SCOPE</TT> must be available to all the components, servlets and JSPs that belong to the same component application and that handle a request identified as being a part of the same session. Objects stored in the session using the <TT>COMPONENT_SCOPE</TT> must be available to the component during requests for the same content that the objects where stored from. Attributes stored in the <TT>COMPONENT_SCOPE</TT> are not protected from other web components of the component application. They are just conveniently namespaced.</P>
+
+<P>The component session extends the Servlet API <TT>HttpSession</TT>. Therefore all <TT>HttpSession</TT> listeners do apply to the component session and attributes set in the component session are visible in the <TT>HttpSession</TT> and vice versa.</P>
+
+<P>The attribute accessor methods without the <EM>scope</EM> parameter always refer to <TT>COMPONENT_SCOPE</TT> attributes. To access <TT>APPLICATION_SCOPE</TT> attributes use the accessors taking an explicit <TT>scope</TT> parameter.</P>
+
+<P><EM>A final note on Sessions</EM>: Sessions are server side sessions and hence violate the sessionless principle of REST and therefore should be used with care. It is almost always possible to not use sessions.</P>
+
+
+
+<H2><A name="SlingAPI-DispatchingRequests"></A>Dispatching Requests</H2>
+
+<P>To include renderings of child Content objects, a <TT>org.apache.sling.component.ComponentRequestDispatcher</TT> object may be retrieved from the ComponentContext with which the Component has been initialized or from the ComponentRequest provided to the service method. Using this dispatcher the reponse of rendering the Content may be included by calling the <TT>ComponentRequestDispatcher.include(ComponentRequest, ComponentResponse)</TT> method.</P>
+
+<P>This method is comparable to the <TT>RequestDispatcher.include(ServletRequest, ServletResponse</TT> method of the Servlet API but dispatching by the <TT>ComponentRequestDispatcher</TT> does not go through the servlet container and stays within the Component Framework.</P>
+
+<P>The <TT>service</TT> method of included Components are called with an instance of the <TT>ComponentRequest</TT> interface whose <TT>getContent()</TT> returns the Content object for the included Content.</P>
+
+<P>When a Component is included by another component the following request attributes are set:</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> <B>Request Attributes</B> </TH>
+<TH class="confluenceTh"> <B>Type</B> </TH>
+<TH class="confluenceTh"> <B>Description</B> </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.component.request.content</TT> </TD>
+<TD class="confluenceTd"> String </TD>
+<TD class="confluenceTd"> The <TT>Content</TT> instance to which the client URL resolved. This attribute is set when included Components are being rendered and it is not set for the Component directly addressed by the client request. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.component.request.component</TT> </TD>
+<TD class="confluenceTd"> String </TD>
+<TD class="confluenceTd"> The <TT>Component</TT> instance for the <TT>Content</TT> object to which the client URL resolved. This attribute is set when included Components are being rendered and it is not set for the Component directly addressed by the client request. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+
+<H3><A name="SlingAPI-ErrorHandling"></A>Error Handling</H3>
+
+<P>While processing requests, the <TT>service</TT> methods called may have problems. Components have multiple options of reporting issues during processing to the client:</P>
+
+<UL>
+	<LI>Set the status of the HTTP response calling the <TT>ComponentResponse.setStatus</TT> method</LI>
+	<LI>Send an error page calling the <TT>ComponentResponse.sendError</TT> method</LI>
+	<LI>Throw an exception</LI>
+</UL>
+
+
+
+<P>If such an exception is thrown, the Component Framework must act upon the exception in one of the following ways:</P>
+
+<UL>
+	<LI>If the request is processed through Servlet API request inclusion, the exception must be given back to the servlet container. A <TT>ComponentException</TT> is just forwarded as a <TT>ServletException</TT>. This is a requirement of the Servlet API specification which states for included requests:</LI>
+</UL>
+
+
+<BLOCKQUOTE>
+<P><B>SRV.8.5 Error Handling</B><BR class="atl-forced-newline">If the servlet that is the target of a request dispatcher throws a runtime exception or a checked exception of type ServletException or IOException, it should be propagated to the calling servlet. All other exceptions should be wrapped as ServletExceptions and the root cause of the exception set to the original exception, as it should not be propagated.</P></BLOCKQUOTE>
+
+<UL>
+	<LI>Otherwise, the Component Framework may handle the error itself in a manner similar to the error handling approach defined the Servlet API specification (Section SRV 9.9 Error Handling of the Java Servlet Specification 2.4). Specifically the request attributes defined by the Servlet API specification must be set for the error handler:</LI>
+</UL>
+
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> <B>Request Attributes</B> </TH>
+<TH class="confluenceTh"> <B>Type</B> </TH>
+<TH class="confluenceTh"> <B>Description</B> </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>javax.servlet.error.status_code</TT> </TD>
+<TD class="confluenceTd"> <TT>java.lang.Integer</TT> </TD>
+<TD class="confluenceTd"> The status code of the response. In the case of an exception thrown from the <TT>service</TT>, the code is defined by the Component Framework. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>javax.servlet.error.exception_type</TT> </TD>
+<TD class="confluenceTd"> <TT>java.lang.Class</TT> </TD>
+<TD class="confluenceTd"> The fully qualified name of the exception class thrown. This attribute does not exist, if error handling does not result from an exception. This attribute is maintained for backwards compatibility according to the Servlet API Specification. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>javax.servlet.error.message</TT> </TD>
+<TD class="confluenceTd"> <TT>java.lang.String</TT> </TD>
+<TD class="confluenceTd"> The message of the exception thrown. This attribute does not exist, if error handling does not result from an exception. This attribute is maintained for backwards compatibility according to the Servlet API Specification. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>javax.servlet.error.exception</TT> </TD>
+<TD class="confluenceTd"> <TT>java.lang.Throwable</TT> </TD>
+<TD class="confluenceTd"> The exception thrown. This attribute does not exist, if error handling does not result from an exception. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>javax.servlet.error.request_uri</TT> </TD>
+<TD class="confluenceTd"> <TT>java.lang.String</TT> </TD>
+<TD class="confluenceTd"> The request URL whose processing resulted in the error. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>javax.servlet.error.servlet_name</TT> </TD>
+<TD class="confluenceTd"> <TT>java.lang.String</TT> </TD>
+<TD class="confluenceTd"> The name of the servlet which yielded the error. The servlet name will generally not have any significance inside the Component Framework. </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>org.apache.sling.component.error.componentId</TT> </TD>
+<TD class="confluenceTd"> <TT>java.lang.String</TT> </TD>
+<TD class="confluenceTd"> The identifier of the Component whose <TT>service</TT> method has caused the error. This attribute does not exist, if the Component Framework itself caused the error processing. </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+<UL>
+	<LI>If the Component Framework decides to not handle the error itself, the exception must be forwarded to the servlet container as a <TT>ComponentException</TT> wrapping the original exception as its root cause.</LI>
+</UL>
+
+
+<P>This specification does not define, how error handlers are configured and used if the Component Framework provides error handling support. Likewise the Component Framework may or may not implement support to handle calls to the <TT>ComponentResponse.sendError</TT> method. The Component Framework may also use its own error handling also for errors resulting from request processing failures, for example if authentication is required or if the request URL cannot be resolved to a Content object.</P>
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by bdelacretaz on 2009-08-25 02:28:57.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/sling-settings-orgapacheslingsettings.html
==============================================================================
--- websites/staging/sling/trunk/content/site/sling-settings-orgapacheslingsettings.html (added)
+++ websites/staging/sling/trunk/content/site/sling-settings-orgapacheslingsettings.html Wed Dec 12 09:16:44 2012
@@ -0,0 +1,138 @@
+
+<!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 - Sling Settings (org.apache.sling.settings)</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="Sling Settings (org.apache.sling.settings)">Sling Settings (org.apache.sling.settings)</A>
+        </DIV>
+<H1><A name="SlingSettings%28org.apache.sling.settings%29-Overview"></A>Overview</H1>
+
+<P>The Sling Settings Bundle exposes the <TT>SlingSettingsService</TT> which allows access to the following information pertinent to a Sling instance:</P>
+
+<DIV class="table-wrap">
+<TABLE class="confluenceTable"><TBODY>
+<TR>
+<TH class="confluenceTh"> Method </TH>
+<TH class="confluenceTh"> Bundle Context Property </TH>
+<TH class="confluenceTh"> Description </TH>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>String getSlingId()</TT> </TD>
+<TD class="confluenceTd"> &mdash; </TD>
+<TD class="confluenceTd"> A unique identifier of the running Sling instance. This value is created when Sling is first started and may be used to identify the instance, for example if multiple Sling instances are running on top of a Jackrabbit Repository Cluster </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>String getSlingHomePath()</TT> </TD>
+<TD class="confluenceTd"> <TT>sling.home</TT> </TD>
+<TD class="confluenceTd"> The absolute filesystem path to the directory where Sling stores all its content </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>URL getSlingHome()</TT> </TD>
+<TD class="confluenceTd"> <TT>sling.home.url</TT> </TD>
+<TD class="confluenceTd"> The Sling Home path as an <TT>java.net.URL</TT> instance </TD>
+</TR>
+<TR>
+<TD class="confluenceTd"> <TT>Set&lt;String&gt; getRunModes()</TT> </TD>
+<TD class="confluenceTd"> <TT>sling.run.modes</TT> </TD>
+<TD class="confluenceTd"> The active Run Modes of the running Sling instance </TD>
+</TR>
+</TBODY></TABLE>
+</DIV>
+
+
+<P>The new Sling Settings Bundle replaces the former <A href="run-modes-orgapacheslingrunmode.html" title="Run Modes (org.apache.sling.runmode)">Run Modes &#40;org.apache.sling.runmode&#41;</A> Bundle and the <TT>SlingSettingsService</TT> previously provided by the Sling Engine bundle.</P>
+
+
+<H2><A name="SlingSettings%28org.apache.sling.settings%29-RunModes"></A>Run Modes</H2>
+
+<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>
+
+
+<H3><A name="SlingSettings%28org.apache.sling.settings%29-Configuration"></A>Configuration</H3>
+
+<P>Run modes can only be configured using a system property, or via the <TT>sling.properties</TT> file.</P>
+
+<P>Using <TT>-Dsling.run.modes=foo,bar</TT> 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 (<TT>sling.run.modes=dev,staging</TT>) that might be present in the <TT>sling.properties</TT> file found in the Sling home directory.</P>
+
+
+<H3><A name="SlingSettings%28org.apache.sling.settings%29-GettingtheRunModesoftheSlinginstance"></A>Getting the Run Modes of the Sling instance</H3>
+
+<P>The <TT>SlingSettings</TT> service provides the Run Modes of the running Sling instance, 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">
+SlingSettings settings = ...get from BundleContext...
+Set&lt;<SPAN class="code-object">String</SPAN>&gt; currentRunModes = settings.getRunModes();
+
+Set&lt;<SPAN class="code-object">String</SPAN>&gt; expectedRunModes = <SPAN class="code-keyword">new</SPAN> HashSet&lt;<SPAN class="code-object">String</SPAN>&gt;(){{ add(<SPAN class="code-quote">&quot;foo&quot;</SPAN>);add(<SPAN class="code-quote">&quot;wii&quot;</SPAN>); }};
+<SPAN class="code-keyword">if</SPAN>(expectedRunModes.removeAll(currentRunModes)) {
+  <SPAN class="code-comment">// at least one of (foo,wii) run modes
+</SPAN>  <SPAN class="code-comment">// is active
+</SPAN>}
+</PRE>
+</DIV></DIV>
+        <DIV class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+Last modified by fmeschbe on 2010-08-27 01:50:26.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