This patch fixes the issue with ALL portlets of the same type on the same page having their events fired when one of those types is requested.
Thanks to Mark Orciuch for his pointing me to the JspAction example.
Scott
Index: VelocityPortletAction.java
===================================================================
RCS file:
/home/cvspublic/jakarta-jetspeed/src/java/org/apache/jetspeed/modules/actions/portlets/VelocityPortletAction.java,v
retrieving revision 1.9
diff -u -r1.9 VelocityPortletAction.java
--- VelocityPortletAction.java 11 Mar 2002 07:22:11 -0000 1.9
+++ VelocityPortletAction.java 30 Sep 2002 14:20:01 -0000
@@ -56,6 +56,7 @@
import org.apache.jetspeed.portal.portlets.VelocityPortlet;
import org.apache.jetspeed.services.rundata.JetspeedRunData;
+import org.apache.jetspeed.util.PortletSessionState;
// Turbine stuff
import org.apache.turbine.util.Log;
@@ -241,5 +242,36 @@
Context context,
RunData rundata )
throws Exception;
+
+ /**
+ * Override VelocityAction.executeEvents to provide the
+ * logic of allowing only the requested portlet to fire
+ * it's events, preventing other portlets, who have the same
+ * action event defined, from firing unexpectedly.
+ */
+ public void executeEvents(RunData data, Context context) throws Exception
+ {
+ VelocityPortlet portlet = (VelocityPortlet)context.get("portlet");
+
+ // Ignore submits from other instances of the same portlet
+ if (PortletSessionState.isMyRequest(data, portlet))
+ {
+ super.executeEvents(data, context);
+ }
+ else
+ {
+ /*
+ * We should always default to buildNormalContext() to be safe
+ * as opposed to doPerform() which could have unexpected
+ * consequences if it has been manually overriden. perform()
+ * is also an unwise choice as it could itself invoke
+ * doPerform(). buildNormalContext() is the most logical
+ * choice as it is the most commonly expected behavior
+ * of non-requested portlets.
+ */
+ Log.debug("VelocityAction: building normal");
+ buildNormalContext(portlet, context, data);
+ }
+ }
}-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
