You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2020/04/26 15:06:31 UTC
[sling-org-apache-sling-servlets-annotations] branch master
updated: SLING-9399 : Add new filter properties
This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-servlets-annotations.git
The following commit(s) were added to refs/heads/master by this push:
new b186246 SLING-9399 : Add new filter properties
b186246 is described below
commit b1862469ccf43f3b3e90518c8c6bd6c3139f6470
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sun Apr 26 17:06:21 2020 +0200
SLING-9399 : Add new filter properties
---
.../servlets/annotations/SlingServletFilter.java | 46 ++++++++++++++++------
1 file changed, 35 insertions(+), 11 deletions(-)
diff --git a/src/main/java/org/apache/sling/servlets/annotations/SlingServletFilter.java b/src/main/java/org/apache/sling/servlets/annotations/SlingServletFilter.java
index 3db093d..7b6a638 100644
--- a/src/main/java/org/apache/sling/servlets/annotations/SlingServletFilter.java
+++ b/src/main/java/org/apache/sling/servlets/annotations/SlingServletFilter.java
@@ -20,14 +20,14 @@ import org.apache.sling.api.servlets.ServletResolverConstants;
import org.osgi.service.component.annotations.ComponentPropertyType;
import org.osgi.service.component.propertytypes.ServiceRanking;
-/**
- * Component Property Type (as defined by OSGi DS 1.4) for Sling Servlet Filters.
- * Takes care of writing the relevant service properties as being used by the Sling Servlet Resolver
+/**
+ * Component Property Type (as defined by OSGi DS 1.4) for Sling Servlet Filters.
+ * Takes care of writing the relevant service properties as being used by the Sling Servlet Resolver
* ({@link ServletResolverConstants}) to register the annotated servlet filter component as
- * Sling servlet filter.
+ * Sling servlet filter.
* <br><br>
- * The order of the filter is determined by the property {@code service.ranking}. To set it use the annotation {@link ServiceRanking}. Its value is used to sort the filters.
- * Filters with a higher order are executed before a filter with a lower order. If two filters have the same order,
+ * The order of the filter is determined by the property {@code service.ranking}. To set it use the annotation {@link ServiceRanking}. Its value is used to sort the filters.
+ * Filters with a higher order are executed before a filter with a lower order. If two filters have the same order,
* the one with the lower service id is executed first.
* <br>
* <br>
@@ -38,7 +38,7 @@ import org.osgi.service.component.propertytypes.ServiceRanking;
* @see <a href=
* "https://github.com/apache/felix/blob/trunk/tools/org.apache.felix.scr.annotations/src/main/java/org/apache/felix/scr/annotations/sling/SlingFilter.java">Felix
* SCR annotation</a>
- * @see <a href="https://sling.apache.org/documentation/the-sling-engine/filters.html">Sling Servlet Filter</a>
+ * @see <a href="https://sling.apache.org/documentation/the-sling-engine/filters.html">Sling Servlet Filter</a>
*/
@ComponentPropertyType
public @interface SlingServletFilter {
@@ -55,13 +55,37 @@ public @interface SlingServletFilter {
*/
SlingServletFilterScope[] scope() default SlingServletFilterScope.REQUEST;
- /**
+ /**
+ * Restrict the filter to resource or request paths that match the supplied regular expression.
+ * <i>Important: The regex is matched against both, the request path and, the resolved resource
+ * path excluding selectors, extension and suffix.</i>
+ * Empty value will not restrict the filter on path(s).
+ * <i>Sling Engine version < 2.6.14 : Only the request path is checked.</i>
+ * <i>Sling Engine version >= 2.6.14 and < 2.7.0 : Only the resource path is checked.</i>
+ * Requires Sling Engine 2.4.0.
+ * @return the path pattern to restrict the filter
+ */
+ String pattern() default "";
+
+ /**
* Restrict the filter to resource paths that match the supplied regular expression.
- * <i>Important: The regex is matched against the resolved resource path excluding selectors, extension and suffix and not the request path!</i>
- * Empty value will not restrict the filter on resource path(s). Requires Sling Engine 2.4.0.
+ * <i>Important: The regex is matched against the resolved resource
+ * path excluding selectors, extension and suffix.</i>
+ * Empty value will not restrict the filter.
+ * Requires Sling Engine 2.7.0.
* @return the resource path pattern to restrict the filter
*/
- String pattern() default "";
+ String resource_pattern() default "";
+
+ /**
+ * Restrict the filter to request paths that match the supplied regular expression.
+ * <i>Important: The regex is matched against the request
+ * path excluding selectors, extension and suffix!</i>
+ * Empty value will not restrict the filter.
+ * Requires Sling Engine 2.7.0.
+ * @return the resource path pattern to restrict the filter
+ */
+ String request_pattern() default "";
/**
* Restrict the filter to request suffixes that match the supplied regular expression.