Author: mwringe
Date: 2009-11-24 19:34:26 -0500 (Tue, 24 Nov 2009)
New Revision: 793
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
Log:
Fix issue with render url parameters not being sent to the portlet container
(GTNPORTAL-294).
Add check to make sure that a portlet has permission to be producing an event
(GTNPORTAL-293).
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2009-11-24
21:44:27 UTC (rev 792)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2009-11-25
00:34:26 UTC (rev 793)
@@ -149,6 +149,7 @@
private List<String> supportModes_;
private List<QName> supportedProcessingEvents_;
+ private List<QName> supportedPublishingEvents_;
private List<String> supportedPublicParams_;
private boolean portletInPortal_ = true;
private StateString navigationalState;
@@ -488,14 +489,49 @@
QName eventName = iter.next();
if (eventName.equals(name))
{
- log.info("The Portlet " + producerOfferedPortletContext + "
supports the event : " + name);
+ log.info("The Portlet " + producerOfferedPortletContext + "
supports comsuming the event : " + name);
return true;
}
}
- log.info("The portlet " + producerOfferedPortletContext + "
doesn't support the event : " + name);
+ log.info("The portlet " + producerOfferedPortletContext + "
doesn't support consuming the event : " + name);
return false;
}
+ public boolean supportsPublishingEvent (QName name)
+ {
+ if (supportedPublishingEvents_ == null)
+ {
+ org.gatein.pc.api.Portlet portlet = getProducedOfferedPortlet();
+
+ if (portlet == null)
+ {
+ log.info("Could not find portlet with ID : " +
producerOfferedPortletContext.getId());
+ return false;
+ }
+
+ Map<QName, EventInfo> producedEvents = (Map<QName,
EventInfo>)portlet.getInfo().getEventing().getProducedEvents();
+
+ if (producedEvents == null)
+ {
+ return false;
+ }
+
+ supportedPublishingEvents_ = new
ArrayList<QName>(producedEvents.keySet());
+ }
+
+ for (Iterator<QName> iter = supportedPublishingEvents_.iterator();
iter.hasNext();)
+ {
+ QName eventName = iter.next();
+ if (eventName.equals(name))
+ {
+ log.info("The Portlet " + producerOfferedPortletContext + "
supports producing the event : " + name);
+ return true;
+ }
+ }
+ log.info("The portlet " + producerOfferedPortletContext + "
doesn't support producing the event : " + name);
+ return false;
+ }
+
/**
* Tells, according to the info located in portlet.xml, wether this portlet supports
the public render parameter
* given as a method argument
Modified:
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java
===================================================================
---
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2009-11-24
21:44:27 UTC (rev 792)
+++
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortletActionListener.java 2009-11-25
00:34:26 UTC (rev 793)
@@ -211,8 +211,11 @@
{
for (UpdateNavigationalStateResponse.Event nsEvent : nsEvents)
{
- javax.portlet.Event portletEvent = new PortletEvent(nsEvent.getName(),
nsEvent.getPayload());
- events.add(portletEvent);
+ if (uiPortlet.supportsPublishingEvent(nsEvent.getName()))
+ {
+ javax.portlet.Event portletEvent = new PortletEvent(nsEvent.getName(),
nsEvent.getPayload());
+ events.add(portletEvent);
+ }
}
}
@@ -597,8 +600,8 @@
setupPublicRenderParams(uiPortlet, request.getParameterMap());
//set render params
- Map<String, String[]> renderParams =
((PortalRequestContext)event.getRequestContext()).getPortletParameters();
- uiPortlet.setNavigationalState(ParametersStateString.create(renderParams));
+ String navState =
((PortalRequestContext)event.getRequestContext()).getRequestParameter(ExoPortletInvocationContext.NAVIGATIONAL_STATE_PARAM_NAME);
+ uiPortlet.setNavigationalState(ParametersStateString.create(navState));
}
}