[gatein-commits] gatein SVN: r2405 - in components/wsrp/trunk: common/src/test/java/org/gatein/wsrp/other and 1 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Mar 31 08:03:42 EDT 2010


Author: chris.laprun at jboss.com
Date: 2010-03-31 08:03:41 -0400 (Wed, 31 Mar 2010)
New Revision: 2405

Modified:
   components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
   components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
   components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/MarkupProcessor.java
Log:
- GTNWSRP-7: Slight improvements.

Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java	2010-03-31 04:55:06 UTC (rev 2404)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java	2010-03-31 12:03:41 UTC (rev 2405)
@@ -95,7 +95,7 @@
    {
       if (resourceURL != null)
       {
-         createURLParameter(sb, WSRPRewritingConstants.RESOURCE_URL, URLTools.encodeXWWWFormURL(resourceURL.toExternalForm()));
+         createURLParameter(sb, WSRPRewritingConstants.RESOURCE_URL, getResourceId());
       }
 
       createURLParameter(sb, WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE, requiresRewrite ? "true" : "false");
@@ -173,6 +173,10 @@
 
    public String getResourceId()
    {
+      if (resourceId == null && resourceURL != null)
+      {
+         resourceId = URLTools.encodeXWWWFormURL(resourceURL.toExternalForm());
+      }
       return resourceId;
    }
 

Modified: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java	2010-03-31 04:55:06 UTC (rev 2404)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/other/WSRPPortletURLTestCase.java	2010-03-31 12:03:41 UTC (rev 2405)
@@ -59,6 +59,7 @@
       WSRPResourceURL resource = (WSRPResourceURL)url;
       assertFalse(resource.requiresRewrite());
       assertEquals("http://test.com/images/test.gif", resource.getResourceURL().toExternalForm());
+      assertEquals("http%3A%2F%2Ftest.com%2Fimages%2Ftest.gif", resource.getResourceId());
    }
 
    /** Declare a secure interaction back to the Portlet */

Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/MarkupProcessor.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/MarkupProcessor.java	2010-03-31 04:55:06 UTC (rev 2404)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/MarkupProcessor.java	2010-03-31 12:03:41 UTC (rev 2405)
@@ -23,7 +23,6 @@
 
 package org.gatein.wsrp.consumer;
 
-import org.gatein.common.net.URLTools;
 import org.gatein.common.util.ParameterValidation;
 import org.gatein.pc.api.URLFormat;
 import org.gatein.pc.api.spi.PortletInvocationContext;
@@ -71,16 +70,6 @@
          match = match.substring(WSRPRewritingConstants.BEGIN_WSRP_REWRITE_END.length());
 
          WSRPPortletURL portletURL = WSRPPortletURL.create(match, supportedCustomModes, supportedCustomWindowStates, true);
-         if (portletURL instanceof WSRPResourceURL)
-         {
-            WSRPResourceURL resource = (WSRPResourceURL)portletURL;
-
-            // bridge the WSRP 1 resources with JSR-286-style
-            // set the URL as the new resource ID, must be encoded as it will be used in URLs
-            String s = URLTools.encodeXWWWFormURL(resource.getResourceURL().toExternalForm());
-            resource.setResourceId(s);
-         }
-
          return context.renderURL(portletURL, format);
       }
       else



More information about the gatein-commits mailing list