You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by pa...@apache.org on 2022/02/21 09:54:02 UTC

[sling-org-apache-sling-servlets-resolver] branch master updated: SLING-11155: bind proxy resource type registrations by path (#27)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 18aee66  SLING-11155: bind proxy resource type registrations by path (#27)
18aee66 is described below

commit 18aee66a0da5d2097ad5151aabdeace5e822132f
Author: Karl Pauls <ka...@gmail.com>
AuthorDate: Mon Feb 21 10:49:37 2022 +0100

    SLING-11155: bind proxy resource type registrations by path (#27)
---
 .../resolver/internal/bundle/BundledScriptTracker.java        | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/main/java/org/apache/sling/servlets/resolver/internal/bundle/BundledScriptTracker.java b/src/main/java/org/apache/sling/servlets/resolver/internal/bundle/BundledScriptTracker.java
index 2519657..613b6ba 100644
--- a/src/main/java/org/apache/sling/servlets/resolver/internal/bundle/BundledScriptTracker.java
+++ b/src/main/java/org/apache/sling/servlets/resolver/internal/bundle/BundledScriptTracker.java
@@ -267,6 +267,17 @@ public class BundledScriptTracker implements BundleTrackerCustomizer<List<Servic
                                     });
                                     properties.put(ServletResolverConstants.SLING_SERVLET_PATHS, paths.toArray(new String[0]));
                                 }
+                                if (!properties.containsKey(ServletResolverConstants.SLING_SERVLET_PATHS)) {
+                                    bundledRenderUnitCapability.getResourceTypes().forEach(resourceType -> {
+                                        String path;
+                                        if (resourceType.toString().startsWith("/")) {
+                                            path = resourceType.toString() + "/" + resourceType.getResourceLabel() + "." + FilenameUtils.getExtension(scriptName);
+                                        } else {
+                                            path = resourceResolverFactory.getSearchPath().get(0) + resourceType.toString() + "/" + resourceType.getResourceLabel() + "." + FilenameUtils.getExtension(scriptName);
+                                        }
+                                        properties.put(ServletResolverConstants.SLING_SERVLET_PATHS, path);
+                                    });
+                                }
                             }
                             if (!properties.containsKey(ServletResolverConstants.SLING_SERVLET_PATHS)) {
                                 bundledRenderUnitCapability.getResourceTypes().forEach(resourceType -> {