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:33:55 UTC

[sling-org-apache-sling-servlets-resolver] 01/01: SLING-11155: bind proxy resource type registrations by path

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

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

commit 4cd050c60c090c9d6b010c248277d9fd01ff155c
Author: Karl Pauls <ka...@gmail.com>
AuthorDate: Mon Feb 21 10:33:39 2022 +0100

    SLING-11155: bind proxy resource type registrations by path
---
 .../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 62f8726..a5360d5 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 -> {