You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2011/09/01 21:01:52 UTC

svn commit: r1164210 - /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentEventLinkEncoderImpl.java

Author: hlship
Date: Thu Sep  1 19:01:51 2011
New Revision: 1164210

URL: http://svn.apache.org/viewvc?rev=1164210&view=rev
Log:
TAP5-743: Make a correction to page render request decoding that appears to only occur when testing with Selenium

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentEventLinkEncoderImpl.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentEventLinkEncoderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentEventLinkEncoderImpl.java?rev=1164210&r1=1164209&r2=1164210&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentEventLinkEncoderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ComponentEventLinkEncoderImpl.java Thu Sep  1 19:01:51 2011
@@ -89,7 +89,7 @@ public class ComponentEventLinkEncoderIm
 
         boolean hasAppFolder = applicationFolder.equals("");
 
-        applicationFolderPrefix = hasAppFolder ? null : SLASH + applicationFolder + SLASH;
+        applicationFolderPrefix = hasAppFolder ? null : SLASH + applicationFolder;
 
         String applicationFolderPattern = hasAppFolder ? "" : applicationFolder + SLASH;
 
@@ -292,9 +292,17 @@ public class ComponentEventLinkEncoderIm
 
             assert path.substring(0, prefixLength).equalsIgnoreCase(applicationFolderPrefix);
 
+            // This checks that the character after the prefix is a slash ... the extra complexity
+            // only seems to occur in Selenium. There's some ambiguity about what to do with a request for
+            // the application folder that doesn't end with a slash. Manuyal with Chrome and IE 8 shows that such
+            // requests are passed through with a training slash,  automated testing with Selenium and FireFox
+            // can include requests for the folder without the trailing slash.
+
+            assert path.length() <= prefixLength || path.charAt(prefixLength) == '/';
+
             // Strip off the folder prefix (i.e., "/foldername"), leaving the rest of the path (i.e., "/en/pagename").
 
-            path = path.substring(prefixLength - 1);
+            path = path.substring(prefixLength);
         }