incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1539586 - in /sling/trunk/bundles/servlets/resolver/src: main/java/org/apache/sling/servlets/resolver/internal/ main/resources/res/ui/ test/java/org/apache/sling/servlets/resolver/internal/
Date Thu, 07 Nov 2013 10:19:53 GMT
Author: bdelacretaz
Date: Thu Nov  7 10:19:53 2013
New Revision: 1539586

URL: http://svn.apache.org/r1539586
Log:
SLING-3006 - add and explain emily.andrews example

Modified:
    sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
    sling/trunk/bundles/servlets/resolver/src/main/resources/res/ui/styles.css
    sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/DecomposedURLTest.java

Modified: sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java?rev=1539586&r1=1539585&r2=1539586&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
(original)
+++ sling/trunk/bundles/servlets/resolver/src/main/java/org/apache/sling/servlets/resolver/internal/SlingServletResolver.java
Thu Nov  7 10:19:53 2013
@@ -1180,6 +1180,14 @@ public class SlingServletResolver
             if (StringUtils.isBlank(method)) {
                 method = "GET";
             }
+            
+            final String CONSOLE_PATH_WARNING = 
+                    "<em>"
+                    + "Note that in a real Sling request, the path might vary depending on
the existence of"
+                    + " resources that partially match it."
+                    + "<br/>This utility does not take this into account and uses the
first dot to split"
+                    + " between path and selectors/extension."
+                    + "</em>";
 
             ResourceResolver resourceResolver = null;
             try {
@@ -1225,7 +1233,7 @@ public class SlingServletResolver
                     tdContent(pw);
                     pw.println("<dl>");
                     pw.println("<dt>Path</dt>");
-                    pw.println("<dd>" + requestPathInfo.getResourcePath() + "</dd>");
+                    pw.println("<dd>" + requestPathInfo.getResourcePath() + "<br/>"
+ CONSOLE_PATH_WARNING + "</dd>");
                     pw.println("<dt>Selectors</dt>");
                     pw.print("<dd>");
                     if (requestPathInfo.getSelectors().length == 0) {

Modified: sling/trunk/bundles/servlets/resolver/src/main/resources/res/ui/styles.css
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/main/resources/res/ui/styles.css?rev=1539586&r1=1539585&r2=1539586&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/main/resources/res/ui/styles.css (original)
+++ sling/trunk/bundles/servlets/resolver/src/main/resources/res/ui/styles.css Thu Nov  7
10:19:53 2013
@@ -27,4 +27,9 @@ ol.servlets li {
 }
 .content dd {
     margin-left: 10px;
-} 
\ No newline at end of file
+} 
+
+.content em {
+	text-style:italic;
+	color:gray;
+}
\ No newline at end of file

Modified: sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/DecomposedURLTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/DecomposedURLTest.java?rev=1539586&r1=1539585&r2=1539586&view=diff
==============================================================================
--- sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/DecomposedURLTest.java
(original)
+++ sling/trunk/bundles/servlets/resolver/src/test/java/org/apache/sling/servlets/resolver/internal/DecomposedURLTest.java
Thu Nov  7 10:19:53 2013
@@ -60,6 +60,26 @@ public class DecomposedURLTest {
                     "html",
                     null,
                     null
+            });
+            
+            // dots are always considered separators between path and selectors/extension,
+            // as mentioned on the webconsole plugin path warning.
+            result.add(new Object[] { 
+                    "/home/users/geometrixx-outdoors/emily.andrews@mailinator.com/profile.form.html/content/geometrixx-outdoors/en/user/profile",
+                    "/home/users/geometrixx-outdoors/emily",
+                    "com",
+                    "andrews@mailinator",
+                    "/profile.form.html/content/geometrixx-outdoors/en/user/profile"
+            });
+            
+            // the trick is to replace dots with _, which gives the same results as
+            // if a resource exists at ...@mailinator.com/profile
+            result.add(new Object[] { 
+                    "/home/users/geometrixx-outdoors/emily_andrews@mailinator_com/profile.form.html/content/geometrixx-outdoors/en/user/profile",
+                    "/home/users/geometrixx-outdoors/emily_andrews@mailinator_com/profile",
+                    "html",
+                    "form",
+                    "/content/geometrixx-outdoors/en/user/profile"
             }); 
             return result;
     }



Mime
View raw message