portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dettb...@apache.org
Subject svn commit: r570689 - in /portals/pluto/branches/1.1-286-COMPATIBILITY: pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/RenderParameterTest.java
Date Wed, 29 Aug 2007 08:09:43 GMT
Author: dettborn
Date: Wed Aug 29 01:09:42 2007
New Revision: 570689

URL: http://svn.apache.org/viewvc?rev=570689&view=rev
Log:
Committed patch: URL_Parser_And_TestCase_Merged_Combine_from_Benjamin_082907.patch     from
JIRA 420 (http://issues.apache.org/jira/browse/PLUTO-420).

Thanks Benjamin

Modified:
    portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java
    portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/RenderParameterTest.java

Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java?rev=570689&r1=570688&r2=570689&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java
(original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-portal-driver-impl/src/main/java/org/apache/pluto/driver/url/impl/PortalURLParserImpl.java
Wed Aug 29 01:09:42 2007
@@ -75,6 +75,7 @@
             new String[] { ">",  "0x7" },
             new String[] { " ",  "0x8" },
             new String[] { "#",  "0x9" },
+            new String[] { "+",  "0xd" },
     };
     
     // Constructor -------------------------------------------------------------
@@ -141,7 +142,7 @@
         	if (!token.startsWith(PREFIX)) {
 //        		renderPath.append(token);
         		//Fix for PLUTO-243
-        		renderPath.append('/').append(token);
+        		renderPath.append('/').append(decodeCharacters(token));
         	}
 //        	 Resource window definition: portalURL.setResourceWindow().
            else if (token.startsWith(PREFIX + RESOURCE)) {
@@ -209,7 +210,11 @@
     	
         // Start the pathInfo with the path to the render URL (page).
         if (portalURL.getRenderPath() != null) {
-        	buffer.append("/").append(portalURL.getRenderPath());
+        	String renderPath = portalURL.getRenderPath().startsWith("/") 
+            		? portalURL.getRenderPath().substring(1)
+            		: portalURL.getRenderPath();
+            buffer.append("/").append(encodeQueryParam(
+            		encodeCharacters(renderPath)));
         }
         //Append the resource window definition, if it exists.        
         if (portalURL.getResourceWindow() != null){
@@ -221,7 +226,8 @@
         if (portalURL.getActionWindow() != null) {
         	buffer.append("/");
         	buffer.append(PREFIX).append(ACTION)
-        			.append(encodeCharacters(portalURL.getActionWindow()));
+        			.append(encodeQueryParam(
+        					encodeCharacters(portalURL.getActionWindow())));
         }
         
         // Append portlet mode definitions.
@@ -312,8 +318,8 @@
                                           String name) {
     	StringBuffer buffer = new StringBuffer();
     	buffer.append(PREFIX).append(type)
-    			.append(encodeCharacters(windowId))
-    			.append(DELIM).append(name);
+    			.append(encodeQueryParam(encodeCharacters(windowId)))
+    			.append(DELIM).append(encodeQueryParam(name));
     	return buffer.toString();
     }
     
@@ -338,7 +344,7 @@
             	buffer.append(VALUE_DELIM);
             }
         }
-        return encodeCharacters(buffer.toString());
+        return encodeQueryParam(encodeCharacters(buffer.toString()));
     }
     
     /**

Modified: portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/RenderParameterTest.java
URL: http://svn.apache.org/viewvc/portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/RenderParameterTest.java?rev=570689&r1=570688&r2=570689&view=diff
==============================================================================
--- portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/RenderParameterTest.java
(original)
+++ portals/pluto/branches/1.1-286-COMPATIBILITY/pluto-testsuite/src/main/java/org/apache/pluto/testsuite/test/RenderParameterTest.java
Wed Aug 29 01:09:42 2007
@@ -23,6 +23,9 @@
 import java.util.Map;
 
 import javax.portlet.PortletRequest;
+import javax.portlet.PortletResponse;
+import javax.portlet.PortletURL;
+import javax.portlet.RenderResponse;
 
 /**
  * @author <a href="mailto:ddewolf@apache.org">David H. DeWolf</a>
@@ -90,6 +93,22 @@
         return result;
     }
 
+    protected TestResult checkSpecialCharactersEncoding(PortletResponse response) {
+    	TestResult result = new TestResult();
+    	result.setDescription("Ensure that render parameters are properly url-encoded.");
+    	PortletURL url = ((RenderResponse) response).createRenderURL();
+    	url.setParameter("Ä & ü", "< ö >");
+    	String test = url.toString().trim();
+    	if (test.indexOf("Ä") > -1 || test.indexOf("ü") > -1 
+    			|| test.indexOf("ö") > -1 || test.indexOf(" ") > -1) { 
+    		TestUtils.failOnAssertion("Generated URL", test, 
+    				"A properly url-form-encoded string", result);
+    	} else {
+    		result.setReturnCode(TestResult.PASSED);
+    	}
+    	return result;
+    }
+    
     protected TestResult checkParameterMap(PortletRequest request) {
         TestResult result = new TestResult();
         result.setDescription("Ensure that render request returns the correct "



Mime
View raw message