Return-Path: X-Original-To: apmail-sling-commits-archive@www.apache.org Delivered-To: apmail-sling-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9E2B610F4E for ; Thu, 7 Nov 2013 10:20:24 +0000 (UTC) Received: (qmail 47875 invoked by uid 500); 7 Nov 2013 10:20:21 -0000 Delivered-To: apmail-sling-commits-archive@sling.apache.org Received: (qmail 47812 invoked by uid 500); 7 Nov 2013 10:20:19 -0000 Mailing-List: contact commits-help@sling.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@sling.apache.org Delivered-To: mailing list commits@sling.apache.org Received: (qmail 47796 invoked by uid 99); 7 Nov 2013 10:20:18 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Nov 2013 10:20:18 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Nov 2013 10:20:15 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D8C82238889B; Thu, 7 Nov 2013 10:19:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@sling.apache.org From: bdelacretaz@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131107101953.D8C82238889B@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 = + "" + + "Note that in a real Sling request, the path might vary depending on the existence of" + + " resources that partially match it." + + "
This utility does not take this into account and uses the first dot to split" + + " between path and selectors/extension." + + "
"; ResourceResolver resourceResolver = null; try { @@ -1225,7 +1233,7 @@ public class SlingServletResolver tdContent(pw); pw.println("
"); pw.println("
Path
"); - pw.println("
" + requestPathInfo.getResourcePath() + "
"); + pw.println("
" + requestPathInfo.getResourcePath() + "
" + CONSOLE_PATH_WARNING + "
"); pw.println("
Selectors
"); pw.print("
"); 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; }