Author: buildbot
Date: Mon Jul  6 08:23:56 2015
New Revision: 957178

Log:
Staging update by buildbot for sling

Modified:
    websites/staging/sling/trunk/content/   (props changed)
    
websites/staging/sling/trunk/content/documentation/the-sling-engine/errorhandling.html

Propchange: websites/staging/sling/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Mon Jul  6 08:23:56 2015
@@ -1 +1 @@
-1688837
+1689335

Modified: 
websites/staging/sling/trunk/content/documentation/the-sling-engine/errorhandling.html
==============================================================================
--- 
websites/staging/sling/trunk/content/documentation/the-sling-engine/errorhandling.html
 (original)
+++ 
websites/staging/sling/trunk/content/documentation/the-sling-engine/errorhandling.html
 Mon Jul  6 08:23:56 2015
@@ -39,7 +39,18 @@
     </div>
     
     <div class="menu"> 
-      <p><strong><a href="/documentation.html">Documentation</a></strong> <br 
/>
+      <style type="text/css">
+/* The following code is added by mdx_elementid.py
+   It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+  visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, 
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, 
dt:hover > .elementid-permalink { visibility: visible }</style>
+<p><strong><a href="/documentation.html">Documentation</a></strong> <br />
 <a href="/documentation/getting-started.html">Getting Started</a> <br />
 <a href="/documentation/the-sling-engine.html">The Sling Engine</a> <br />
 <a href="/documentation/development.html">Development</a> <br />
@@ -90,9 +101,22 @@
       
       
       <h1>Errorhandling</h1>
-      <p>The Sling Engine includes support for handling uncaught 
<code>Throwable</code> as well as rendering custom HTTP status code pages. This 
is implemented by expecting a (single) 
<code>org.apache.sling.engine.servlets.ErrorHandler</code> service to which 
handling of uncaught <code>Throwable</code> and HTTP status responses are 
delegated.</p>
+      <style type="text/css">
+/* The following code is added by mdx_elementid.py
+   It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+  visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, 
h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, 
dt:hover > .elementid-permalink { visibility: visible }</style>
+<p>The Sling Engine includes support for handling uncaught 
<code>Throwable</code> as well as rendering custom HTTP status code pages. This 
is implemented by expecting a (single) 
<code>org.apache.sling.engine.servlets.ErrorHandler</code> service to which 
handling of uncaught <code>Throwable</code> and HTTP status responses are 
delegated.</p>
 <p>The Sling Servlet Resolver bundle implements this interface by providing an 
elaborate mechanism to find the correct error handling script or servlet using 
the same algorithms as are used to select the scripts or servlets to handle 
regular requests.</p>
 <p>This page provides more information on how error handler scripts are 
selected and what is provided out of the box.</p>
+<p>The <a 
href="https://svn.apache.org/repos/asf/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolver/errorhandler/ErrorHandlingTest.java";>ErrorHandlingTest</a>
 in our integration tests suite provides 
+working examples of various error handling scenarios.</p>
 <div class="toc">
 <ul>
 <li><a href="#resetting-the-response">Resetting the Response</a></li>
@@ -101,7 +125,7 @@
 <li><a href="#default-handler">Default Handler</a></li>
 </ul>
 </div>
-<h2 id="resetting-the-response">Resetting the Response</h2>
+<h2 id="resetting-the-response">Resetting the Response<a class="headerlink" 
href="#resetting-the-response" title="Permanent link">&para;</a></h2>
 <p>Errorhandler scripts and servlets are script with the current response. 
Before setting
 the status and writing to the response such handlers should do the 
following:</p>
 <ul>
@@ -118,7 +142,7 @@ the status and writing to the response s
 </ul>
 </li>
 </ul>
-<h2 id="http-status-codes">HTTP Status Codes</h2>
+<h2 id="http-status-codes">HTTP Status Codes<a class="headerlink" 
href="#http-status-codes" title="Permanent link">&para;</a></h2>
 <p>The Sling engine implements the <code>HttpServletResponse.sendError</code> 
methods by calling the <code>ErrorHandler.handleError(int status, String 
message, SlingHttpServletRequest request, SlingHttpServletResponse 
response)</code> method.</p>
 <p>The Servlet Resolver bundle implementation looks up a script to handle the 
status code as follows:</p>
 <ul>
@@ -130,12 +154,12 @@ the status and writing to the response s
 <li>An application provider my provide a default handler for the 404/NOT FOUND 
status. This script might be located in 
<code>/libs/sling/servlet/errorhandler/404.jsp</code>.</li>
 <li>An programmer might provide a handler for the 403/FORBIDDEN status in 
<code>/apps/sling/servlet/errorhandler/403.esp</code>.</li>
 </ul>
-<h2 id="uncaught-throwables">Uncaught Throwables</h2>
+<h2 id="uncaught-throwables">Uncaught Throwables<a class="headerlink" 
href="#uncaught-throwables" title="Permanent link">&para;</a></h2>
 <p>To handle uncaught Throwables the simple name 
(<code>Class.getSimpleName()</code>) of the <code>Throwable</code> class is 
used as request extension. Similarly to the Java try-catch clauses the class 
hierarchy is supported. That is to handle an uncaught 
<code>FileNotFoundException</code>, the names 
<code>FileNotFoundException</code>, <code>IOException</code>, 
<code>Exception</code>, <code>Throwable</code> are checked for a Servlet and 
the first one found is then used. Again, the Serlvet may be a Servlet 
registered as an OSGi service or may be a plain script stored in the JCR 
repository or provided through some custom Resource provider.</p>
 <p><strong>Example:</strong>
 To register a catch-all handler for any uncaught Throwables you might create a 
script <code>/apps/sling/servlet/errorhandler/Throwable.esp</code>.</p>
 <p><strong>Note:</strong> If no script or servlet to handle an uncaught 
<code>Throwable</code> is registered, the default handler kicks in, which sends 
back a 500/INTERNAL SERVER ERROR response containing the <code>Throwable</code> 
and the stack trace. This response is <strong>not</strong> handled by the HTTP 
Status Code handling described above because the response status is sent using 
<code>HttpServletResponse.setStatus(int, String)</code>. To prevent this 
default response you have to implement a catch-all handler for the 
<code>Throwable</code> class as shown in the example.</p>
-<h2 id="default-handler">Default Handler</h2>
+<h2 id="default-handler">Default Handler<a class="headerlink" 
href="#default-handler" title="Permanent link">&para;</a></h2>
 <p>The Sling Servlet Resolver bundle provides a default error handler servlet 
which is used if the algorithms described above do not resolve to a handler 
script or servlet. The provided error handler servlet does the following:</p>
 <ul>
 <li>Print a descriptive message, which is the 
<code>javax.servlet.error.message</code> request attribute by default</li>
@@ -145,7 +169,7 @@ To register a catch-all handler for any
 <p>Starting with Sling Servlet Resolver version 2.0.10 the default error 
handler servlet is looked up using the string <code>default</code> as the 
request extension and the provided default servlet is registered as 
<code>&lt;prefix&gt;/sling/servlet/errorhandler/default.servlet</code> where 
<prefix> is the last entry in the resource resolver search path, 
<code>/libs</code> by default.</p>
 <p>Thus to overwrite the default error handler servlet provide a servlet or 
script for the <code>default</code> extension, for example 
<code>/apps/sling/servlet/errorhandler/default.groovy</code>.</p>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; 
text-align: right;">
-        Rev. 1500501 by fmeschbe on Sun, 7 Jul 2013 18:49:51 +0000
+        Rev. 1689335 by bdelacretaz on Mon, 6 Jul 2015 08:23:41 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache 
Sling project


Reply via email to