You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2022/03/16 06:42:48 UTC

[sling-org-apache-sling-servlets-resolver] branch master updated: SLING-11209 : Use SlingUriBuilder to build RequestPathInfo

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

cziegeler 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 8d87edd  SLING-11209 : Use SlingUriBuilder to build RequestPathInfo
8d87edd is described below

commit 8d87edd2f7b5768a608b460894bd811e2896b1f1
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Wed Mar 16 07:42:38 2022 +0100

    SLING-11209 : Use SlingUriBuilder to build RequestPathInfo
---
 bnd.bnd                                            |  7 -------
 pom.xml                                            | 23 ----------------------
 .../internal/console/WebConsolePlugin.java         | 16 +++++----------
 3 files changed, 5 insertions(+), 41 deletions(-)

diff --git a/bnd.bnd b/bnd.bnd
index 05a4426..3facbe4 100644
--- a/bnd.bnd
+++ b/bnd.bnd
@@ -1,13 +1,6 @@
-Import-Package:\
-  !org.apache.sling.engine.impl.*,\
-  *
-
 Provide-Capability:\
   osgi.extender;osgi.extender="org.apache.sling.servlets.resolver";version:Version="1.1"
 
--includeresource:\
-  @org.apache.sling.engine-*.jar!/org/apache/sling/engine/impl/request/SlingRequestPathInfo*
-
 -plugin:\
   org.apache.sling.bnd.plugin.headers.parameters.remove.Plugin;\
     'Require-Capability'='osgi.service;filter:="(objectClass=org.apache.sling.servlets.resolver.internal.resolution.ResolutionCache)";effective:=active',\
diff --git a/pom.xml b/pom.xml
index 85320d9..67fe38b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -73,29 +73,6 @@
                     <doclint>none</doclint>
                 </configuration>
             </plugin>
-           <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-shade-plugin</artifactId>
-                <version>3.2.4</version>
-                <executions>
-                    <execution>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>shade</goal>
-                        </goals>
-                        <configuration>
-                            <createSourcesJar>true</createSourcesJar>
-                            <shadeSourcesContent>true</shadeSourcesContent>
-                            <relocations>
-                                <relocation>
-                                    <pattern>org.apache.sling.engine.impl.request</pattern>
-                                    <shadedPattern>org.apache.sling.servlets.resolver.internal.engine</shadedPattern>
-                                </relocation>
-                            </relocations>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
             <plugin>
                 <groupId>org.apache.servicemix.tooling</groupId>
                 <artifactId>depends-maven-plugin</artifactId>
diff --git a/src/main/java/org/apache/sling/servlets/resolver/internal/console/WebConsolePlugin.java b/src/main/java/org/apache/sling/servlets/resolver/internal/console/WebConsolePlugin.java
index af09cb7..0615b6c 100644
--- a/src/main/java/org/apache/sling/servlets/resolver/internal/console/WebConsolePlugin.java
+++ b/src/main/java/org/apache/sling/servlets/resolver/internal/console/WebConsolePlugin.java
@@ -43,14 +43,12 @@ import org.apache.sling.api.request.RequestPathInfo;
 import org.apache.sling.api.request.ResponseUtil;
 import org.apache.sling.api.resource.LoginException;
 import org.apache.sling.api.resource.Resource;
-import org.apache.sling.api.resource.ResourceMetadata;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.resource.ResourceResolverFactory;
 import org.apache.sling.api.resource.ResourceUtil;
-import org.apache.sling.api.resource.SyntheticResource;
 import org.apache.sling.api.scripting.SlingScript;
 import org.apache.sling.api.servlets.OptingServlet;
-import org.apache.sling.engine.impl.request.SlingRequestPathInfo;
+import org.apache.sling.api.uri.SlingUriBuilder;
 import org.apache.sling.serviceusermapping.ServiceUserMapped;
 import org.apache.sling.servlets.resolver.internal.ResolverConfig;
 import org.apache.sling.servlets.resolver.internal.SlingServletResolver;
@@ -476,7 +474,7 @@ public class WebConsolePlugin extends HttpServlet {
         }
     }
 
-    public static RequestPathInfo getRequestPathInfo(String urlString) {
+    static RequestPathInfo getRequestPathInfo(String urlString) {
 
         if(urlString == null) {
             urlString = "";
@@ -491,13 +489,9 @@ public class WebConsolePlugin extends HttpServlet {
                 // ignored
             }
         }
-        final int firstDot = fullPath.indexOf(".");
-
-        final ResourceMetadata metadata = new ResourceMetadata();
-        final Resource r = new SyntheticResource(null, metadata, null); // NOSONAR
-        metadata.setResolutionPath(firstDot < 0 ? fullPath : fullPath.substring(0, firstDot));
-        metadata.setResolutionPathInfo(firstDot < 0 ? null : fullPath.substring(firstDot));
-        return new SlingRequestPathInfo(r);
+        return SlingUriBuilder.create()
+            .setPath(fullPath)
+            .build();
     }
 
 }