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:54 UTC

[sling-org-apache-sling-servlets-resolver] branch SLING-11155 created (now 4cd050c)

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

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


      at 4cd050c  SLING-11155: bind proxy resource type registrations by path

This branch includes the following new commits:

     new 4cd050c  SLING-11155: bind proxy resource type registrations by path

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


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

Posted by pa...@apache.org.
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 -> {