You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2025/07/17 14:13:01 UTC

(sling-site) branch master updated: SLING-12855 - document the IgnoredServletResourcePredicate

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

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


The following commit(s) were added to refs/heads/master by this push:
     new d9f1d8ab2 SLING-12855 - document the IgnoredServletResourcePredicate
d9f1d8ab2 is described below

commit d9f1d8ab2cc058bc3dcd8f2f063d95fd4dcb4f1a
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Jul 17 16:12:50 2025 +0200

    SLING-12855 - document the IgnoredServletResourcePredicate
---
 .../content/documentation/the-sling-engine/servlets.md    | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/main/jbake/content/documentation/the-sling-engine/servlets.md b/src/main/jbake/content/documentation/the-sling-engine/servlets.md
index ce4d05323..e407389e6 100644
--- a/src/main/jbake/content/documentation/the-sling-engine/servlets.md
+++ b/src/main/jbake/content/documentation/the-sling-engine/servlets.md
@@ -321,3 +321,18 @@ Error handling support is described on the [Errorhandling](/documentation/the-sl
 
 For certain edge cases even in an OSGi runtime running Sling certain servlets are still registered leveraging the [OSGi HTTP Whiteboard](https://docs.osgi.org/specification/osgi.cmpn/7.0.0/service.http.whiteboard.html) instead of leveraging the Sling servlet registration outlined above.
 Note though, that whenever the Sling engine bundle is deployed it registers a Servlet with the OSGi HTTP Whiteboard for path `/` which will take precedence by default over all other servlets registered through OSGi Http Whiteboard leveraging the *default* servlet context [SLING-11677](https://issues.apache.org/jira/browse/SLING-11677). Therefore, all servlets registered via OSGi HTTP Whiteboard need to be registered with a custom context having a `service.ranking` higher than the one fro [...]
+
+## IgnoredServletResourcePredicate
+
+The `IgnoredServletResourcePredicate` API allows specific Scripts and Servlets to be ignored by the servlets resolver.
+
+Implemented since versions 2.11.12 and 3.0.2 of the servlets resolver bundle, it is simply a `Predicate<Resource>`
+which causes a given Script or Servlet resource path to be ignored if the `Predicate` returns `true`.
+
+It was created to allow "soft deprecation" of scripts and servlets, which can remain present in your codebase while
+not being used by Sling.
+
+The test code ([BasicResourceHidingIT](https://github.com/apache/sling-org-apache-sling-servlets-resolver/blob/master/src/test/java/org/apache/sling/servlets/resolver/it/resourcehiding/BasicResourceHidingIT.java) for example) shows how to use this API.
+
+The resolver considers a single OSGi service with this interface, if several are presents the winner is selected
+based on its service ranking.
\ No newline at end of file