You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by al...@apache.org on 2007/05/09 17:08:06 UTC

svn commit: r536558 - in /incubator/wicket/trunk/jdk-1.4/wicket/src: main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java test/java/org/apache/wicket/protocol/http/WebRequestCodingStrategyTest.java

Author: almaw
Date: Wed May  9 08:08:05 2007
New Revision: 536558

URL: http://svn.apache.org/viewvc?view=rev&rev=536558
Log:
Fix WICKET-65 properly.

Modified:
    incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
    incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/protocol/http/WebRequestCodingStrategyTest.java

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java?view=diff&rev=536558&r1=536557&r2=536558
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/main/java/org/apache/wicket/protocol/http/request/WebRequestCodingStrategy.java Wed May  9 08:08:05 2007
@@ -16,8 +16,6 @@
  */
 package org.apache.wicket.protocol.http.request;
 
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
 import java.util.Collection;
 import java.util.Comparator;
 import java.util.Iterator;
@@ -404,10 +402,6 @@
 			throw new IllegalArgumentException(
 					"The mount path '/' is reserved for the application home page");
 		}
-		if (encoder == null)
-		{
-			throw new IllegalArgumentException("Argument encoder must be not-null");
-		}
 
 		// sanity check
 		if (path.startsWith("/"))
@@ -709,10 +703,13 @@
 			while (iterator.hasNext())
 			{
 				final String key = (String)iterator.next();
-				final String value = parameters.getString(key);
-				if (value != null)
+				final String values[] = parameters.getStringArray(key);
+				if (values != null)
 				{
-					encoder.addValue(key, value);
+					for (int i = 0; i < values.length; i++)
+					{
+						encoder.addValue(key, values[i]);
+					}
 				}
 			}
 		}

Modified: incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/protocol/http/WebRequestCodingStrategyTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/protocol/http/WebRequestCodingStrategyTest.java?view=diff&rev=536558&r1=536557&r2=536558
==============================================================================
--- incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/protocol/http/WebRequestCodingStrategyTest.java (original)
+++ incubator/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/protocol/http/WebRequestCodingStrategyTest.java Wed May  9 08:08:05 2007
@@ -33,7 +33,7 @@
 	/**
 	 * WICKET-65 Handle String array in PageParameters
 	 */
-	public void bugTestEncodeStringArray()
+	public void testEncodeStringArray()
 	{
 		WebRequestCodingStrategy wrcs = new WebRequestCodingStrategy();
 		WicketTester app = new WicketTester();
@@ -45,16 +45,7 @@
 				MockPage.class, params);
 		app.setupRequestAndResponse();
 		CharSequence cs = wrcs.encode(app.createRequestCycle(), requestTarget);
-		assertEquals("?a=1&a=2", cs.toString());
+		assertEquals("?wicket:bookmarkablePage=%3Aorg.apache.wicket.protocol.http.MockPage&a=1&a=2", cs.toString());
 		app.destroy();
-	}
-
-	/**
-	 * Dummy test method. This can be removed and
-	 * {@link #bugTestEncodeStringArray()} renamed to testX when WICKET-65 is
-	 * handled.
-	 */
-	public void testDummy()
-	{
 	}
 }