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 d97acc0  SLING-9406 - Add bundled script support to the servlets 
resolver
d97acc0 is described below

commit d97acc0fea5a10b5fd57adc1766aaedff48ef93f
Author: Karl Pauls <[email protected]>
AuthorDate: Tue May 19 02:23:40 2020 +0200

    SLING-9406 - Add bundled script support to the servlets resolver
    
    * Only add the default servlet extension to path based servlets when no 
resource types are given or there isn't any.
---
 .../internal/resource/ServletResourceProviderFactory.java        | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/src/main/java/org/apache/sling/servlets/resolver/internal/resource/ServletResourceProviderFactory.java
 
b/src/main/java/org/apache/sling/servlets/resolver/internal/resource/ServletResourceProviderFactory.java
index aafa484..b2f17b4 100644
--- 
a/src/main/java/org/apache/sling/servlets/resolver/internal/resource/ServletResourceProviderFactory.java
+++ 
b/src/main/java/org/apache/sling/servlets/resolver/internal/resource/ServletResourceProviderFactory.java
@@ -221,8 +221,13 @@ public class ServletResourceProviderFactory {
                 // add the unmodified path
                 pathSet.add(path);
 
-                // ensure we have another entry which has the .servlet ext.
-                pathSet.add(ensureServletNameExtension(path));
+                String[] types = 
PropertiesUtil.toStringArray(ref.getProperty(SLING_SERVLET_RESOURCE_TYPES));
+
+                if ((types == null || types.length == 0) || 
StringUtils.isEmpty(FilenameUtils.getExtension(path))) {
+                    // ensure we have another entry which has the .servlet 
ext. if there wasn't one to begin with
+                    // Radu says: this will make sure that scripts are equal 
to servlets in the resolution process
+                    pathSet.add(ensureServletNameExtension(path));
+                }
             }
         }
     }

Reply via email to