Author: chris.laprun(a)jboss.com
Date: 2010-08-10 09:22:57 -0400 (Tue, 10 Aug 2010)
New Revision: 3792
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ResourceRequestProcessor.java
Log:
- GTNWSRP-54: do not transmit resource id placeholder to portlet.
Modified:
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java
===================================================================
---
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java 2010-08-10
12:50:44 UTC (rev 3791)
+++
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/ResourceHandler.java 2010-08-10
13:22:57 UTC (rev 3792)
@@ -177,9 +177,9 @@
}
// if the portlet didn't request a resource id, use the fake one:
- if (resourceId == null || resourceId.length() == 0)
+ if (ParameterValidation.isNullOrEmpty(resourceId))
{
- resourceId = WSRPResourceURL.DEFAULT_RESOURCE_ID;
+ throw new IllegalArgumentException("GetResource needs a valid resource
id.");
}
// Create ResourceParams
Modified:
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ResourceRequestProcessor.java
===================================================================
---
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ResourceRequestProcessor.java 2010-08-10
12:50:44 UTC (rev 3791)
+++
components/wsrp/trunk/producer/src/main/java/org/gatein/wsrp/producer/ResourceRequestProcessor.java 2010-08-10
13:22:57 UTC (rev 3792)
@@ -27,6 +27,7 @@
import org.gatein.pc.api.invocation.ResourceInvocation;
import org.gatein.pc.api.state.AccessMode;
import org.gatein.pc.portlet.impl.jsr168.PortletUtils;
+import org.gatein.wsrp.WSRPResourceURL;
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
import org.oasis.wsrp.v2.GetResource;
@@ -110,7 +111,12 @@
ResourceParams resourceParams = this.getResource.getResourceParams();
-
resourceInvocation.setResourceId(this.getResource.getResourceParams().getResourceID());
+ // only set the resource id if it's different from the place holder we use if
the portlet doesn't set one
+ String id = this.getResource.getResourceParams().getResourceID();
+ if (!WSRPResourceURL.DEFAULT_RESOURCE_ID.equals(id))
+ {
+ resourceInvocation.setResourceId(id);
+ }
WSRPRequestContext requestContext =
WSRPRequestContext.createRequestContext(markupRequest, resourceParams);
resourceInvocation.setRequestContext(requestContext);