sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r1001707 - in /websites/staging/sling/trunk/content: ./ documentation/the-sling-engine/servlets.html
Date Sun, 27 Nov 2016 11:57:45 GMT
Author: buildbot
Date: Sun Nov 27 11:57:45 2016
New Revision: 1001707

Log:
Staging update by buildbot for sling

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

Propchange: websites/staging/sling/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Sun Nov 27 11:57:45 2016
@@ -1 +1 @@
-1771571
+1771572

Modified: websites/staging/sling/trunk/content/documentation/the-sling-engine/servlets.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/the-sling-engine/servlets.html (original)
+++ websites/staging/sling/trunk/content/documentation/the-sling-engine/servlets.html Sun
Nov 27 11:57:45 2016
@@ -176,35 +176,34 @@ to a script or and servlet.</p>
 <p>If you are working with the default Apache Sling development stack you can either
use </p>
 <ul>
 <li><a href="https://osgi.org/javadoc/r6/cmpn/org/osgi/service/component/annotations/package-summary.html">OSGi
DS annotations</a> (introduced with DS 1.2/OSGi 5, properly supported since <a href="https://github.com/bndtools/bndtools/wiki/Changes-in-3.0.0">bnd
3.0</a>, being used in <a href="http://felix.apache.org/documentation/subprojects/apache-felix-maven-bundle-plugin-bnd.html">maven-bundle-plugin
3.0.0</a>) or </li>
-<li>
-<p>Generic Felix SCR or Sling-specific <code>@SlingServlet</code> annotations
from <a href="http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin.html">Apache
Felix Maven SCR Plugin</a> to register your Sling servlets:</p>
-</li>
-<li>
-<p>OSGi DS annotations (recommended)</p>
-<div class="codehilite"><pre><span class="nd">@Component</span><span
class="o">(</span>
-<span class="n">service</span> <span class="o">=</span> <span
class="o">{</span> <span class="n">Servlet</span><span class="o">.</span><span
class="na">class</span> <span class="o">},</span>
-<span class="n">property</span> <span class="o">=</span> <span
class="o">{</span> 
-    <span class="n">SLING_SERVLET_RESOURCE_TYPES</span> <span class="o">+</span>
<span class="s">&quot;=/apps/my/type&quot;</span>
-    <span class="n">SLING_SERVLET_METHODS</span> <span class="o">+</span>
<span class="s">&quot;=GET&quot;</span><span class="o">,</span>
-    <span class="n">SLING_SERVLET_EXTENSIONS</span> <span class="o">+</span>
<span class="s">&quot;=html&quot;</span><span class="o">,</span>
-    <span class="n">SLING_SERVLET_SELECTORS</span> <span class="o">+</span>
<span class="s">&quot;=hello&quot;</span><span class="o">,</span>
-  <span class="o">}</span>
-<span class="o">)</span>
-<span class="kd">public</span> <span class="kd">class</span> <span
class="nc">MyServlet</span> <span class="kd">extends</span> <span
class="n">SlingSafeMethodsServlet</span> <span class="o">{</span>
+<li>Generic Felix SCR or Sling-specific <code>@SlingServlet</code> annotations
from <a href="http://felix.apache.org/documentation/subprojects/apache-felix-maven-scr-plugin.html">Apache
Felix Maven SCR Plugin</a> to register your Sling servlets:</li>
+</ul>
+<p>The following examples show example code how you can register Servlets with Sling
+1. OSGi DS annotations (recommended)</p>
+<div class="codehilite"><pre>    <span class="p">:::</span><span
class="n">java</span>
+    <span class="p">@</span><span class="n">Component</span><span
class="p">(</span>
+    <span class="n">service</span> <span class="p">=</span> <span
class="p">{</span> <span class="n">Servlet</span><span class="p">.</span><span
class="n">class</span> <span class="p">},</span>
+    <span class="n">property</span> <span class="p">=</span> <span
class="p">{</span> 
+        <span class="n">SLING_SERVLET_RESOURCE_TYPES</span> <span class="o">+</span>
&quot;<span class="p">=</span><span class="o">/</span><span
class="n">apps</span><span class="o">/</span><span class="n">my</span><span
class="o">/</span><span class="n">type</span>&quot;
+        <span class="n">SLING_SERVLET_METHODS</span> <span class="o">+</span>
&quot;<span class="p">=</span><span class="n">GET</span>&quot;<span
class="p">,</span>
+        <span class="n">SLING_SERVLET_EXTENSIONS</span> <span class="o">+</span>
&quot;<span class="p">=</span><span class="n">html</span>&quot;<span
class="p">,</span>
+        <span class="n">SLING_SERVLET_SELECTORS</span> <span class="o">+</span>
&quot;<span class="p">=</span><span class="n">hello</span>&quot;<span
class="p">,</span>
+      <span class="p">}</span>
+    <span class="p">)</span>
+    <span class="n">public</span> <span class="n">class</span> <span
class="n">MyServlet</span> <span class="n">extends</span> <span class="n">SlingSafeMethodsServlet</span>
<span class="p">{</span>
+
+        <span class="p">@</span><span class="n">Override</span>
+        <span class="n">protected</span> <span class="n">void</span>
<span class="n">doGet</span><span class="p">(</span><span class="n">SlingHttpServletRequest</span>
<span class="n">request</span><span class="p">,</span> <span class="n">SlingHttpServletResponse</span>
<span class="n">response</span><span class="p">)</span> <span class="n">throws</span>
<span class="n">ServletException</span><span class="p">,</span> <span
class="n">IOException</span> <span class="p">{</span>
+            <span class="p">...</span>
+        <span class="p">}</span>
+    <span class="p">}</span>
 
-    <span class="nd">@Override</span>
-    <span class="kd">protected</span> <span class="kt">void</span>
<span class="nf">doGet</span><span class="o">(</span><span class="n">SlingHttpServletRequest</span>
<span class="n">request</span><span class="o">,</span> <span class="n">SlingHttpServletResponse</span>
<span class="n">response</span><span class="o">)</span> <span class="kd">throws</span>
<span class="n">ServletException</span><span class="o">,</span> <span
class="n">IOException</span> <span class="o">{</span>
-        <span class="o">...</span>
-    <span class="o">}</span>
-<span class="o">}</span>
+<span class="n">Custom</span> <span class="n">OSGi</span> <span
class="n">DS</span> <span class="n">annotations</span> <span class="p">(</span><span
class="n">e</span><span class="p">.</span><span class="n">g</span><span
class="p">.</span> <span class="k">for</span> <span class="n">Sling</span>
<span class="n">servlets</span><span class="p">)</span> <span class="n">are</span>
<span class="n">not</span> <span class="n">yet</span> <span class="n">supported</span>
<span class="n">by</span> <span class="n">the</span> <span class="n">OSGi</span>
<span class="n">spec</span> <span class="p">(</span><span class="n">and</span>
<span class="n">therefore</span> <span class="n">by</span> <span
class="n">bnd</span><span class="p">),</span> <span class="n">but</span>
<span class="n">this</span> <span class="n">is</span> <span class="n">supposed</span>
<span class="n">to</span> <span class="n">be</span> <span class="n">fixed</span>
<span class="n">with</span> <span class="n">DS</span> 1<span class
 ="p">.</span>4 <span class="p">(</span><span class="n">OSGi</span>
7<span class="p">),</span> <span class="n">see</span> <span class="n">also</span>
<span class="p">[</span><span class="n">FELIX</span><span class="o">-</span>5396<span
class="p">](</span><span class="n">https</span><span class="p">:</span><span
class="o">//</span><span class="n">issues</span><span class="p">.</span><span
class="n">apache</span><span class="p">.</span><span class="n">org</span><span
class="o">/</span><span class="n">jira</span><span class="o">/</span><span
class="n">browse</span><span class="o">/</span><span class="n">FELIX</span><span
class="o">-</span>5396<span class="p">).</span>
 </pre></div>
 
 
-<p>Custom OSGi DS annotations (e.g. for Sling servlets) are not yet supported by the
OSGi spec (and therefore by bnd), but this is supposed to be fixed with DS 1.4 (OSGi 7), see
also <a href="https://issues.apache.org/jira/browse/FELIX-5396">FELIX-5396</a>.</p>
-</li>
-<li>
-<p>The <code>@SlingServlet</code> annotation (evaluated by maven-scr-plugin)</p>
-<div class="codehilite"><pre><span class="nd">@SlingServlet</span><span
class="o">(</span>
+<ol>
+<li>The <code>@SlingServlet</code> annotation (evaluated by maven-scr-plugin)<div
class="codehilite"><pre><span class="nd">@SlingServlet</span><span
class="o">(</span>
     <span class="n">resourceTypes</span> <span class="o">=</span>
<span class="s">&quot;/apps/my/type&quot;</span><span class="o">,</span>
     <span class="n">selectors</span> <span class="o">=</span> <span
class="s">&quot;hello&quot;</span><span class="o">,</span>
     <span class="n">extensions</span> <span class="o">=</span> <span
class="s">&quot;html&quot;</span><span class="o">,</span>
@@ -220,7 +219,7 @@ to a script or and servlet.</p>
 
 
 </li>
-</ul>
+</ol>
 <h3 id="automated-tests">Automated tests<a class="headerlink" href="#automated-tests"
title="Permanent link">&para;</a></h3>
 <p>The <a href="http://svn.apache.org/repos/asf/sling/trunk/launchpad/test-services/">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/">launchpad/integration-tests</a>
module contains a number of tests (like the [ExtensionServletTest|http://svn.apache.org/repos/asf/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/resolution/ExtensionServletTest.java]
for example) that verify the results.</p>
@@ -295,7 +294,7 @@ The mechanism helping the provider here
 <h2 id="error-handler-servlets-or-scripts">Error Handler Servlet(s) or Scripts<a
class="headerlink" href="#error-handler-servlets-or-scripts" title="Permanent link">&para;</a></h2>
 <p>Error handling support is described on the <a href="/documentation/the-sling-engine/errorhandling.html">Errorhandling</a>
page.</p>
       <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
-        Rev. 1771571 by kwin on Sun, 27 Nov 2016 11:55:54 +0000
+        Rev. 1771572 by kwin on Sun, 27 Nov 2016 11:57:36 +0000
       </div>
       <div class="trademarkFooter"> 
         Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project



Mime
View raw message