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 2019/12/19 17:28:29 UTC

[sling-org-apache-sling-servlets-resolver] branch issue/SLING-8936 created (now 0a54087)

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

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


      at 0a54087  Rename variables for clarity

This branch includes the following new commits:

     new 0a54087  Rename variables for clarity

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: Rename variables for clarity

Posted by bd...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0a5408771eedacf04dae4d8a52f3ea3d1a96133a
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Thu Dec 19 18:27:17 2019 +0100

    Rename variables for clarity
---
 .../resolver/internal/SlingServletResolver.java        | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java b/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
index 72e19be..c9f63b8 100644
--- a/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
+++ b/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
@@ -140,7 +140,7 @@ public class SlingServletResolver
         final String timerName = "resolveServlet(" + resource.getPath() + ")";
         tracker.startTimer(timerName);
 
-        final String type = resource.getResourceType();
+        final String resourceType = resource.getResourceType();
         if (LOGGER.isDebugEnabled()) {
             LOGGER.debug("resolveServlet called for resource {}", resource);
         }
@@ -148,8 +148,8 @@ public class SlingServletResolver
         final ResourceResolver scriptResolver = this.getScriptResourceResolver();
         Servlet servlet = null;
 
-        if ( type != null && type.length() > 0 ) {
-            servlet = resolveServletInternal(request, null, type, scriptResolver);
+        if ( resourceType != null && resourceType.length() > 0 ) {
+            servlet = resolveServletInternal(request, null, resourceType, scriptResolver);
         }
 
         // last resort, use the core bundle default servlet
@@ -426,26 +426,26 @@ public class SlingServletResolver
      */
     private Servlet resolveServletInternal(final SlingHttpServletRequest request,
             final Resource resource,
-            final String scriptName,
+            final String scriptNameOrResourceType,
             final ResourceResolver resolver) {
         Servlet servlet = null;
 
         // first check whether the type of a resource is the absolute
         // path of a servlet (or script)
-        if (scriptName.charAt(0) == '/') {
-            final String scriptPath = ResourceUtil.normalize(scriptName);
+        if (scriptNameOrResourceType.charAt(0) == '/') {
+            final String scriptPath = ResourceUtil.normalize(scriptNameOrResourceType);
             if ( isPathAllowed(scriptPath, this.executionPaths) ) {
                 final Resource res = resolver.getResource(scriptPath);
                 servlet = this.getServlet(res);
                 if (servlet != null && LOGGER.isDebugEnabled()) {
                     LOGGER.debug("Servlet {} found using absolute resource type {}", RequestUtil.getServletName(servlet),
-                                    scriptName);
+                                    scriptNameOrResourceType);
                 }
             } else {
                 if ( request != null ) {
                     request.getRequestProgressTracker().log(
                             "Will not look for a servlet at {0} as it is not in the list of allowed paths",
-                            scriptName
+                            scriptNameOrResourceType
                             );
                 }
             }
@@ -456,7 +456,7 @@ public class SlingServletResolver
             if ( request != null ) {
                 locationUtil = ResourceCollector.create(request, this.executionPaths, this.defaultExtensions);
             } else {
-                locationUtil = NamedScriptResourceCollector.create(scriptName, resource, this.executionPaths);
+                locationUtil = NamedScriptResourceCollector.create(scriptNameOrResourceType, resource, this.executionPaths);
             }
             servlet = getServletInternal(locationUtil, request, resolver);