incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1059732 - in /sling/trunk: bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/ bundles/auth/selector/src/main/resources/org/apache/sling/auth/selector/ launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp...
Date Mon, 17 Jan 2011 02:42:04 GMT
Author: justin
Date: Mon Jan 17 02:42:04 2011
New Revision: 1059732

URL: http://svn.apache.org/viewvc?rev=1059732&view=rev
Log:
fixing SLING-1933 by introducing a new variable contextPath which just contains the contextPath

Modified:
    sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationFormServlet.java
    sling/trunk/bundles/auth/selector/src/main/resources/org/apache/sling/auth/selector/login.html
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/FormGenerationTest.java

Modified: sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationFormServlet.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationFormServlet.java?rev=1059732&r1=1059731&r2=1059732&view=diff
==============================================================================
--- sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationFormServlet.java
(original)
+++ sling/trunk/bundles/auth/core/src/main/java/org/apache/sling/auth/core/spi/AbstractAuthenticationFormServlet.java
Mon Jan 17 02:42:04 2011
@@ -131,7 +131,8 @@ public abstract class AbstractAuthentica
         form = form.replace("${resource}", getResource(request));
         form = form.replace("${j_reason}", getReason(request));
         form = form.replace("${requestContextPath}", getContextPath(request));
-
+        form = form.replace("${contextPath}", request.getContextPath());
+        
         return form;
     }
 

Modified: sling/trunk/bundles/auth/selector/src/main/resources/org/apache/sling/auth/selector/login.html
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/auth/selector/src/main/resources/org/apache/sling/auth/selector/login.html?rev=1059732&r1=1059731&r2=1059732&view=diff
==============================================================================
--- sling/trunk/bundles/auth/selector/src/main/resources/org/apache/sling/auth/selector/login.html
(original)
+++ sling/trunk/bundles/auth/selector/src/main/resources/org/apache/sling/auth/selector/login.html
Mon Jan 17 02:42:04 2011
@@ -24,7 +24,7 @@
 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
 <title>Login</title>
 
-    <link rel="stylesheet" type="text/css" href="${requestContextPath}/sling.css"/>
+    <link rel="stylesheet" type="text/css" href="${contextPath}/sling.css"/>
 <style type="text/css">
 body {
     font-family: Verdana, Arial, Helvetica, sans-serif;
@@ -95,7 +95,7 @@ body {
     <div class="title">
         <div class="logo">
             <a href="http://sling.apache.org">
-                <img border="0" src="${requestContextPath}/sling-logo.png"/>
+                <img border="0" src="${contextPath}/sling-logo.png"/>
             </a>
         </div>
     </div>
@@ -107,7 +107,7 @@ body {
   <div class="border">
   
     <p>
-    If you don't have an account, please <a href="${requestContextPath}/signup.html">sign
up</a>.
+    If you don't have an account, please <a href="${contextPath}/signup.html">sign
up</a>.
     </p>
     
     <div id="err">

Modified: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/FormGenerationTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/FormGenerationTest.java?rev=1059732&r1=1059731&r2=1059732&view=diff
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/FormGenerationTest.java
(original)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/login/FormGenerationTest.java
Mon Jan 17 02:42:04 2011
@@ -18,8 +18,6 @@ package org.apache.sling.launchpad.webap
 
 import java.util.Arrays;
 
-import junit.framework.TestCase;
-
 import org.apache.commons.httpclient.NameValuePair;
 import org.apache.sling.commons.testing.integration.HttpTestBase;
 
@@ -28,12 +26,25 @@ import org.apache.sling.commons.testing.
  */
 public class FormGenerationTest extends HttpTestBase {
 
-    public void testSelectorForm() throws Exception {
+    public void testSelectorFormForRootResource() throws Exception {
         String contextPath = getContextPath(HTTP_BASE_URL);
         String content = getContent(HTTP_BASE_URL + "/system/sling/selector/login", CONTENT_TYPE_HTML,
                 Arrays.asList(new NameValuePair("resource", "/")), 200);
 
         assertTrue("form action is not correct.", content.contains("action=\"" + contextPath
+ "/j_security_check\""));
+        assertTrue("sling image reference is not correct.",
+                content.contains("<img border=\"0\" src=\"" + contextPath + "/sling-logo.png\"/>"));
+    }
+
+    public void testSelectorFormForNonRootResource() throws Exception {
+        String contextPath = getContextPath(HTTP_BASE_URL);
+        String content = getContent(HTTP_BASE_URL + "/system/sling/selector/login", CONTENT_TYPE_HTML,
+                Arrays.asList(new NameValuePair("resource", "/var/classes.json")), 200);
+
+        assertTrue("form action is not correct.",
+                content.contains("action=\"" + contextPath + "/var/classes.json/j_security_check\""));
+        assertTrue("sling image reference is not correct.",
+                content.contains("<img border=\"0\" src=\"" + contextPath + "/sling-logo.png\"/>"));
     }
 
     private static String getContextPath(String baseURL) {



Mime
View raw message