Author: rich
Date: Thu Apr 21 09:46:53 2005
New Revision: 164083
URL: http://svn.apache.org/viewcvs?rev=164083&view=rev
Log:
This is a contribution from Carlin Rogers to address
http://issues.apache.org/jira/browse/BEEHIVE-509 : update MutableURI.setQuery()
to account for embedded & separating query parameters
tests: drt in trunk
BB: self (linux)
Modified:
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/MutableURI.java
incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/MutableURITest.java
Modified:
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/MutableURI.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/MutableURI.java?rev=164083&r1=164082&r2=164083&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/MutableURI.java
(original)
+++
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/core/urls/MutableURI.java
Thu Apr 21 09:46:53 2005
@@ -503,6 +503,12 @@
for ( StringTokenizer tok = new StringTokenizer( query, "&" );
tok.hasMoreElements(); )
{
String queryItem = tok.nextToken();
+
+ if ( queryItem.startsWith( "amp;" ) )
+ {
+ queryItem = queryItem.substring( 4 );
+ }
+
int eq = queryItem.indexOf( '=' );
if ( eq != -1 )
{
Modified:
incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/MutableURITest.java
URL:
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/MutableURITest.java?rev=164083&r1=164082&r2=164083&view=diff
==============================================================================
---
incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/MutableURITest.java
(original)
+++
incubator/beehive/trunk/netui/test/src/junitTests/org/apache/beehive/netui/test/core/urls/MutableURITest.java
Thu Apr 21 09:46:53 2005
@@ -259,11 +259,19 @@
String name = "paramName";
String value = "paramValue";
String query = name + "=" + value;
+
+ // test setQuery()
origURI.setPath( path );
uri.setPath( path );
origURI.setQuery( query );
uri.setQuery( query );
assertEquals( uri.getParameter( name ), value );
+
+ // test for query parameter separated by "&" entity
+ query = "param1&param1=&param2";
+ uri.setQuery( query );
+ assertEquals( uri.getQuery(), "param1¶m1=¶m2" );
+ assertEquals( uri.getQueryForXML(), query );
// now use addParameter() to set the query
uri.setQuery( null );