Author: dan.j.allen
Date: 2008-05-23 01:22:40 -0400 (Fri, 23 May 2008)
New Revision: 8268
Modified:
trunk/ui/src/main/java/org/jboss/seam/ui/util/UrlBuilder.java
trunk/ui/src/test/java/org/jboss/seam/ui/test/UrlBuilderTest.java
Log:
JBSEAM-3003
Modified: trunk/ui/src/main/java/org/jboss/seam/ui/util/UrlBuilder.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/util/UrlBuilder.java 2008-05-23 05:22:06 UTC
(rev 8267)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/util/UrlBuilder.java 2008-05-23 05:22:40 UTC
(rev 8268)
@@ -2,7 +2,7 @@
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
import javax.faces.component.UIParameter;
@@ -23,7 +23,7 @@
protected UrlBuilder(String fragment, String characterEncoding)
{
this.fragment = fragment;
- parameters = new HashMap<String, String>();
+ parameters = new LinkedHashMap<String, String>();
this.characterEncoding = characterEncoding;
}
Modified: trunk/ui/src/test/java/org/jboss/seam/ui/test/UrlBuilderTest.java
===================================================================
--- trunk/ui/src/test/java/org/jboss/seam/ui/test/UrlBuilderTest.java 2008-05-23 05:22:06
UTC (rev 8267)
+++ trunk/ui/src/test/java/org/jboss/seam/ui/test/UrlBuilderTest.java 2008-05-23 05:22:40
UTC (rev 8268)
@@ -7,7 +7,6 @@
public class UrlBuilderTest
{
-
@Test
public void testBaseUrlAlreadyHasParams() throws UnsupportedEncodingException
{
@@ -19,4 +18,15 @@
assert "/someurl?arg1=a&foo=bar".equals(encodedUrl);
}
+ @Test
+ public void testParameterOrdering() throws UnsupportedEncodingException
+ {
+ UrlBuilder url = new UrlBuilder("/Hotel.seam", "",
"UTF-8");
+ url.addParameter("hotelId", "5");
+ url.addParameter("cid", "10");
+ url.addParameter("z", "z");
+ url.addParameter("a", "a");
+ String encodedUrl = url.getEncodedUrl();
+ assert
"/Hotel.seam?hotelId=5&cid=10&z=z&a=a".equals(encodedUrl) :
"Parameters not properly ordered";
+ }
}
Show replies by date