You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by np...@apache.org on 2018/09/11 12:02:19 UTC

[sling-site] branch asf-site updated: release of sling servlets annotations 1.1.0

This is an automated email from the ASF dual-hosted git repository.

npeltier pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/sling-site.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new 697e354  release of sling servlets annotations 1.1.0
697e354 is described below

commit 697e354ac98233381c5d768d605040e86108c18a
Author: Nicolas Peltier <np...@adobe.com>
AuthorDate: Tue Sep 11 14:01:38 2018 +0200

    release of sling servlets annotations 1.1.0
---
 documentation/the-sling-engine/filters.html | 71 ++++++++++++++++++++++++++---
 downloads.html                              |  4 +-
 releases.html                               |  3 +-
 3 files changed, 69 insertions(+), 9 deletions(-)

diff --git a/documentation/the-sling-engine/filters.html b/documentation/the-sling-engine/filters.html
index 3398f99..cccd13f 100644
--- a/documentation/the-sling-engine/filters.html
+++ b/documentation/the-sling-engine/filters.html
@@ -122,6 +122,13 @@ from our integration tests shows an example Sling Filter.
       <td>Indication of which chain the filter should be added to. This property is required. If it is missing from the service, the service is ignored because it is assumed another consumer will be interested in using the service. Any unknown values of this property are also ignored causing the service to be completely ignored if none of the values provided by the property are valid. See below for the description of the filter chains. </td>
     </tr>
     <tr>
+      <td><code>service.ranking</code> </td>
+      <td><code>Integer</code> </td>
+      <td><code>0</code> </td>
+      <td>Any <code>Integer</code> value </td>
+      <td>Indication of where to place the filter in the filter chain. The higher the number the earlier in the filter chain. This value may span the whole range of integer values. Two filters with equal <code>service.ranking</code> property value (explicitly set or default value of zero) will be ordered according to their <code>service.id</code> service property as described in section 5.2.5, Service Properties, of the OSGi Core Specification R 4.2. </td>
+    </tr>
+    <tr>
       <td><code>sling.filter.pattern</code> </td>
       <td><code>String</code></td>
       <td><code>(-)</code> </td>
@@ -129,14 +136,66 @@ from our integration tests shows an example Sling Filter.
       <td>Restrict the filter to paths that match the supplied regular expression. Requires Sling Engine 2.4.0. </td>
     </tr>
     <tr>
-      <td><code>service.ranking</code> </td>
-      <td><code>Integer</code> </td>
-      <td><code>0</code> </td>
-      <td>Any <code>Integer</code> value </td>
-      <td>Indication of where to place the filter in the filter chain. The higher the number the earlier in the filter chain. This value may span the whole range of integer values. Two filters with equal <code>service.ranking</code> property value (explicitly set or default value of zero) will be ordered according to their <code>service.id</code> service property as described in section 5.2.5, Service Properties, of the OSGi Core Specification R 4.2. </td>
+      <td><code>sling.filter.suffix.pattern</code> </td>
+      <td><code>String</code></td>
+      <td><code>(-)</code> </td>
+      <td>Any <code>String</code> value </td>
+      <td>Restrict the filter to requests with suffix that match the supplied regular expression. Requires Sling Engine 2.6.14. </td>
+    </tr>
+    <tr>
+      <td><code>sling.filter.selectors</code> </td>
+      <td><code>String[]</code></td>
+      <td><code>(-)</code> </td>
+      <td>Any <code>String</code> value </td>
+      <td>Restrict the filter to requests whose selectors match one or more of the provided ones. Requires Sling Engine 2.6.14. </td>
+    </tr>
+    <tr>
+      <td><code>sling.filter.methods</code> </td>
+      <td><code>String[]</code></td>
+      <td><code>(-)</code> </td>
+      <td>Any <code>String</code> value </td>
+      <td>Restrict the filter to requests whose methods match one or more of the provided ones. Requires Sling Engine 2.6.14. </td>
+    </tr>
+    <tr>
+      <td><code>sling.filter.resourceTypes</code> </td>
+      <td><code>String[]</code></td>
+      <td><code>(-)</code> </td>
+      <td>Any <code>String</code> value </td>
+      <td>Restrict the filter to requests whose resource type match one of the provided ones. Requires Sling Engine 2.6.14. </td>
+    </tr>
+    <tr>
+      <td><code>sling.filter.extensions</code> </td>
+      <td><code>String[]</code></td>
+      <td><code>(-)</code> </td>
+      <td>Any <code>String</code> value </td>
+      <td>Restrict the filter to requests whose extension matches one of the provided ones. Requires Sling Engine 2.6.14. </td>
     </tr>
   </tbody>
 </table>
+<h2><a href="#slingservletfilter-annotation" name="slingservletfilter-annotation">SlingServletFilter Annotation</a></h2>
+<p>Coding the above being a bit tedious, <code>Apache Sling Servlets Annotations 1.1.0</code> provides handy `SlingServletFilter annotation to set those values:</p>
+<p>``` ...  import org.apache.sling.servlets.annotations.SlingServletFilter;  import org.apache.sling.servlets.annotations.SlingServletFilterScope;  import org.osgi.service.component.annotations.Component; ...<br/> @Component  @SlingServletFilter(scope = {SlingServletFilterScope.REQUEST},  suffix_pattern = "/suffix/foo",  resourceTypes = {"foo/bar"},  pattern = "/content/.*",  extensions = {"txt","json"},  selectors = {"foo","bar"},  methods = {"GET","HEAD"})  public class FooBarFilter i [...]
+<pre><code>   @Override
+   public void init(FilterConfig filterConfig) throws ServletException {
+
+   }
+
+   @Override
+   public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
+       SlingHttpServletResponse slingResponse = (SlingHttpServletResponse)response;
+       //will only be run on (GET|HEAD) /content/.*.foo|bar.txt|json/suffix/foo requests
+       //code here can be reduced to what should actually be done in that case
+       //for other requests, this filter will not be in the call stack 
+       slingResponse.addHeader(&quot;foobared&quot;, &quot;true&quot;);
+       chain.doFilter(request, slingResponse);
+   }
+
+   @Override
+   public void destroy() {
+
+   }
+</code></pre>
+<p>} ```</p>
 <h2><a href="#filter-chains" name="filter-chains">Filter Chains</a></h2>
 <p>Sling maintains five filter chains: request level, component level, include filters, forward filters and error filters. Except for the component level filter these filter chains correspond to the filter <code>&lt;dispatcher&gt;</code> configurations as defined for Servlet API 2.5 web applications (see section SRV.6.2.5 Filters and the RequestDispatcher).</p>
 <p>The following table summarizes when each of the filter chains is called and what value must be defined in the <code>sling.filter.scope</code> property to have a filter added to the respective chain:</p>
@@ -262,7 +321,7 @@ Component Filters:
 </ul></section></div></div>            
             <div class="footer">
 <div class="revisionInfo">
-                    Last modified by <span class="author">Konrad Windszus</span> on <span class="comment">Fri Jul 13 11:08:10 2018 +0200</span>
+                    Last modified by <span class="author">Nicolas Peltier</span> on <span class="comment">Tue Sep 11 12:51:28 2018 +0200</span>
                 </div>                <p>
                     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.
                 </p><p>
diff --git a/downloads.html b/downloads.html
index aa4ecfa..dd98b8a 100644
--- a/downloads.html
+++ b/downloads.html
@@ -477,8 +477,8 @@
                                     </td><td><a href="[preferred]sling/org.apache.sling.serviceusermapper-1.4.0-source-release.zip">Source ZIP</a> (<a href="https://www.apache.org/dist/sling/org.apache.sling.serviceusermapper-1.4.0-source-release.zip.asc">asc</a>, <a href="https://www.apache.org/dist/sling/org.apache.sling.serviceusermapper-1.4.0-source-release.zip.sha1">sha1</a>)
                                     </td></tr><tr><td>Service User WebConsole</td><td>1.0.0</td><td><a href="[preferred]sling/org.apache.sling.serviceuser.webconsole-1.0.0.jar">Bundle</a> (<a href="https://www.apache.org/dist/sling/org.apache.sling.serviceuser.webconsole-1.0.0.jar.asc">asc</a>, <a href="https://www.apache.org/dist/sling/org.apache.sling.serviceuser.webconsole-1.0.0.jar.sha1">sha1</a>)
                                     </td><td><a href="[preferred]sling/org.apache.sling.serviceuser.webconsole-1.0.0-source-release.zip">Source ZIP</a> (<a href="https://www.apache.org/dist/sling/org.apache.sling.serviceuser.webconsole-1.0.0-source-release.zip.asc">asc</a>, <a href="https://www.apache.org/dist/sling/org.apache.sling.serviceuser.webconsole-1.0.0-source-release.zip.sha1">sha1</a>)
-                                    </td></tr><tr><td>Servlet Annotations</td><td>1.0.0</td><td><a href="[preferred]sling/org.apache.sling.servlets.annotations-1.0.0.jar">Bundle</a> (<a href="https://www.apache.org/dist/sling/org.apache.sling.servlets.annotations-1.0.0.jar.asc">asc</a>, <a href="https://www.apache.org/dist/sling/org.apache.sling.servlets.annotations-1.0.0.jar.sha1">sha1</a>)
-                                    </td><td><a href="[preferred]sling/org.apache.sling.servlets.annotations-1.0.0-source-release.zip">Source ZIP</a> (<a href="https://www.apache.org/dist/sling/org.apache.sling.servlets.annotations-1.0.0-source-release.zip.asc">asc</a>, <a href="https://www.apache.org/dist/sling/org.apache.sling.servlets.annotations-1.0.0-source-release.zip.sha1">sha1</a>)
+                                    </td></tr><tr><td>Servlet Annotations</td><td>1.1.0</td><td><a href="[preferred]sling/org.apache.sling.servlets.annotations-1.1.0.jar">Bundle</a> (<a href="https://www.apache.org/dist/sling/org.apache.sling.servlets.annotations-1.1.0.jar.asc">asc</a>, <a href="https://www.apache.org/dist/sling/org.apache.sling.servlets.annotations-1.1.0.jar.sha1">sha1</a>)
+                                    </td><td><a href="[preferred]sling/org.apache.sling.servlets.annotations-1.1.0-source-release.zip">Source ZIP</a> (<a href="https://www.apache.org/dist/sling/org.apache.sling.servlets.annotations-1.1.0-source-release.zip.asc">asc</a>, <a href="https://www.apache.org/dist/sling/org.apache.sling.servlets.annotations-1.1.0-source-release.zip.sha1">sha1</a>)
                                     </td></tr><tr><td>Servlet Helpers</td><td>1.1.8</td><td><a href="[preferred]sling/org.apache.sling.servlet-helpers-1.1.8.jar">Bundle</a> (<a href="https://www.apache.org/dist/sling/org.apache.sling.servlet-helpers-1.1.8.jar.asc">asc</a>, <a href="https://www.apache.org/dist/sling/org.apache.sling.servlet-helpers-1.1.8.jar.sha1">sha1</a>)
                                     </td><td><a href="[preferred]sling/org.apache.sling.servlet-helpers-1.1.8-source-release.zip">Source ZIP</a> (<a href="https://www.apache.org/dist/sling/org.apache.sling.servlet-helpers-1.1.8-source-release.zip.asc">asc</a>, <a href="https://www.apache.org/dist/sling/org.apache.sling.servlet-helpers-1.1.8-source-release.zip.sha1">sha1</a>)
                                     </td></tr><tr><td>Servlets Compat</td><td>1.0.2</td><td><a href="[preferred]sling/org.apache.sling.servlets.compat-1.0.2.jar">Bundle</a> (<a href="https://www.apache.org/dist/sling/org.apache.sling.servlets.compat-1.0.2.jar.asc">asc</a>, <a href="https://www.apache.org/dist/sling/org.apache.sling.servlets.compat-1.0.2.jar.sha1">sha1</a>)
diff --git a/releases.html b/releases.html
index 4ce74f1..8c4cc97 100644
--- a/releases.html
+++ b/releases.html
@@ -89,6 +89,7 @@
             </h1><div class="row"><div class="small-12 columns"><section class="wrap"><p>This is a list of all our releases, available from our <a href="/downloads.cgi">downloads</a> page.</p>
 <h2><a href="#september-2018" name="september-2018">September 2018</a></h2>
 <ul>
+  <li>Servlets Annotations 1.1.0 (11th)</li>
   <li>Commons Log 5.1.10 (10th)</li>
   <li>Resource Filter 1.0.0 (8th)</li>
   <li>Context-Aware Configuration API 1.1.2 (5th)</li>
@@ -1827,7 +1828,7 @@
 </ul></section></div></div>
             <div class="footer">
 <div class="revisionInfo">
-                    Last modified by <span class="author">Robert Munteanu</span> on <span class="comment">Mon Sep 10 11:41:00 2018 +0200</span>
+                    Last modified by <span class="author">Nicolas Peltier</span> on <span class="comment">Tue Sep 11 11:28:05 2018 +0200</span>
                 </div>                <p>
                     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.
                 </p><p>