cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rgo...@apache.org
Subject svn commit: r125181 - in cocoon/trunk: . src/blocks/portal/WEB-INF/xconf src/blocks/portal/java/org/apache/cocoon/portal src/blocks/portal/java/org/apache/cocoon/portal/event src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl src/blocks/portal/java/org/apache/cocoon/portal/event/impl src/blocks/portal/java/org/apache/cocoon/portal/impl src/blocks/portal/java/org/apache/cocoon/portal/layout src/blocks/portal/java/org/apache/cocoon/portal/layout/impl src/blocks/portal/java/org/apache/cocoon/portal/pluto
Date Fri, 14 Jan 2005 16:30:18 GMT
Author: rgoers
Date: Fri Jan 14 08:30:17 2005
New Revision: 125181

URL: http://svn.apache.org/viewcvs?view=rev&rev=125181
Log:
fix for bug 33091. JSR-168 Portlet urls do not contain event id's (if configured).

Added:
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/ConvertableEvent.java   (contents, props changed)
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/ConvertableEventFactory.java   (contents, props changed)
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/ConvertableEventAspect.java   (contents, props changed)
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/FullScreenCopletEventFactory.java   (contents, props changed)
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLConverter.java   (contents, props changed)
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLProviderFactory.java   (contents, props changed)
Modified:
   cocoon/trunk/src/blocks/portal/WEB-INF/xconf/cocoon-portal.xconf
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/LinkService.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/EventConverter.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/FullScreenCopletEvent.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/PageLabelEventConverter.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultLinkService.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelManager.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java
   cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java
   cocoon/trunk/status.xml

Modified: cocoon/trunk/src/blocks/portal/WEB-INF/xconf/cocoon-portal.xconf
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/WEB-INF/xconf/cocoon-portal.xconf?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/WEB-INF/xconf/cocoon-portal.xconf&r1=125180&p2=cocoon/trunk/src/blocks/portal/WEB-INF/xconf/cocoon-portal.xconf&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/WEB-INF/xconf/cocoon-portal.xconf	(original)
+++ cocoon/trunk/src/blocks/portal/WEB-INF/xconf/cocoon-portal.xconf	Fri Jan 14 08:30:17 2005
@@ -39,6 +39,9 @@
     <aspect name="request-parameter" class="org.apache.cocoon.portal.event.aspect.impl.RequestParameterEventAspect"/>
     <aspect name="frame" class="org.apache.cocoon.portal.event.aspect.impl.FrameEventAspect"/>
     <aspect name="link"  class="org.apache.cocoon.portal.event.aspect.impl.LinkEventAspect" />    
+    <aspect name="page-label" class="org.apache.cocoon.portal.event.aspect.impl.PageLabelEventAspect"/>
+    <aspect name="convertable" class="org.apache.cocoon.portal.event.aspect.impl.ConvertableEventAspect"/>
+
     <aspect name="full-screen-coplet" class="org.apache.cocoon.portal.event.aspect.impl.FullScreenCopletEventAspect"/>
 
     <!-- This aspect sets headers on the response that tell the client to not cache the response: -->
@@ -47,11 +50,22 @@
 
  <component class="org.apache.cocoon.portal.event.impl.DefaultEventManager" logger="portal" role="org.apache.cocoon.portal.event.EventManager">
     <event-aspects>
+        <!-- Uncomment this aspect when marshalling JSR168 portlet events 
+        <aspect type="convertable"/>
+        -->
+        <!-- Remove action-counter when using PageLabels -->
         <aspect type="action-counter"/>
         <aspect type="frame"/>
         <aspect type="link"/>
         <aspect type="full-screen-coplet"/>
-        <aspect type="request-parameter"/>
+	<!-- Uncomment the following when using PageLabels
+        <aspect type="page-label"/>
+        -->
+        <aspect type="request-parameter">
+          <!-- Uncomment the following when marshalling JSR168 portlet events
+          <parameter name="parameter-name" value="cocoon-portal-event,url"/>
+          -->
+        </aspect>
     </event-aspects>
     <!-- add a new instance of each class as a subscriber: -->
     <subscriber-classes>
@@ -64,6 +78,13 @@
         <!-- <role name="AVALON-ROLE"/> -->
     </subscriber-roles>
  </component>
+ 
+ <!-- Event Factory configuration -->
+ <component class="org.apache.cocoon.components.ExtendedComponentSelector" role="org.apache.cocoon.portal.event.ConvertableEventFactorySelector">
+   <!-- The events that can be marshalled. The name must match the Event's request parameter. -->
+   <factory name="cocoon-portal-fs" class="org.apache.cocoon.portal.event.impl.FullScreenCopletEventFactory"/>
+   <factory name="url" class="org.apache.cocoon.portal.pluto.PortletURLProviderFactory"/>
+ </component>
 
   <!-- This is the portal manager.
        If you don't need the JSR-168 support uncomment the following line and comment out 
@@ -75,9 +96,21 @@
   <component class="org.apache.cocoon.portal.impl.PortletPortalManager" 
              logger="portal" role="org.apache.cocoon.portal.PortalManager"/>
 
+ <!-- To enable PageLabels change DefaultLinkService to PageLabelLinkService -->
  <component class="org.apache.cocoon.portal.impl.DefaultLinkService" logger="portal" role="org.apache.cocoon.portal.LinkService"/>
 
+  <!-- To enable PageLabels change DefaultEventConverter to PageLabelEventConverter -->
  <component class="org.apache.cocoon.portal.event.impl.DefaultEventConverter" logger="portal" role="org.apache.cocoon.portal.event.EventConverter">
+ </component>
+  
+ <!-- Page Label Manager -->
+ <component class="org.apache.cocoon.portal.impl.PageLabelManager" logger="portal" role="org.apache.cocoon.portal.impl.PageLabelManager">
+   <!-- Uncomment to marshall JSR-168 portlet events
+   <marshallEvents>true</marshallEvents>
+   -->
+   <!-- Uncomment to enable non sticky tabs
+   <nonStickyTabs>true</nonStickyTabs>
+   -->
  </component>
 
   <!-- Coplet Adapter configuration -->

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/LinkService.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/LinkService.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/LinkService.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/LinkService.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/LinkService.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/LinkService.java	Fri Jan 14 08:30:17 2005
@@ -31,7 +31,9 @@
     String ROLE = LinkService.class.getName();
     
     String DEFAULT_REQUEST_EVENT_PARAMETER_NAME = "cocoon-portal-event";
-    
+    String DEFAULT_CONVERTABLE_EVENT_PARAMETER_NAME = "javax.portlet.events";
+
+
     static class ParameterDescription {
         public final String parameters;
         public ParameterDescription(String parameters) {
@@ -46,12 +48,31 @@
     String getLinkURI(Event event);
 
     /**
+     * Get the uri for this coplet containing the additional event and using a secure
+     * protocol if requested.
+     *
+     * @param event The event to add (null is also allowed for convenience)
+     * @param secure true if a secure protocol is required, false otherwise.
+     * @return A URI
+     */
+    String getLinkURI(Event event, Boolean secure);
+
+    /**
      * Get the uri for this coplet containing the additional events.
-     * @param events The events to add: These can either be {@link Event}s or {@link #ParameterDescription}s.
+     * @param events The events to add: These can either be {@link Event}s or {@link ParameterDescription}s.
      * @return A URI
      */
     String getLinkURI(List events);
-    
+
+    /**
+     * Get a uri for this coplet containing the additional events. Use a secure
+     * protocol if requested.
+     * @param events The events to add: These can either be {@link Event}s or {@link ParameterDescription}s.
+     * @param secure true if a secure protocol is required, false otherwise.
+     * @return A URI
+     */
+    String getLinkURI(List events, Boolean secure);
+
     /**
      * Add this event to the list of events contained in the uri
      * @param event Event to add
@@ -85,4 +106,11 @@
      * @return A URI
      */
     String getRefreshLinkURI();
+
+    /**
+     * Determine whether the current url is using a secure protocol
+     * @return true if the current url is using a secure protocol
+     */
+    boolean isSecure();
+
 }

Added: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/ConvertableEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/ConvertableEvent.java?view=auto&rev=125181
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/ConvertableEvent.java	Fri Jan 14 08:30:17 2005
@@ -0,0 +1,34 @@
+/*
+ * Copyright 1999-2002,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.portal.event;
+
+/**
+ * Marker interface for portal event 
+ *
+ * @author <a href="mailto:rgoers@apache.org">Ralph Goers/a>
+ * 
+ * @version SVN $Id: $
+ */
+public interface ConvertableEvent extends Event {
+
+    /**
+     * Return the event data as a String
+     * @return The event data as a String
+     */
+    String asString();
+
+    String getRequestParameterName();
+}
\ No newline at end of file

Added: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/ConvertableEventFactory.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/ConvertableEventFactory.java?view=auto&rev=125181
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/ConvertableEventFactory.java	Fri Jan 14 08:30:17 2005
@@ -0,0 +1,40 @@
+/*
+ * Copyright 1999-2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cocoon.portal.event;
+
+import org.apache.avalon.framework.component.Component;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.portal.PortalService;
+
+/**
+ * Interface to be implemented to create Event factories.
+ *
+ * @author  <a href="mailto:rgoers@apache.org">Ralph Goers</a>
+ * @version SVN $Id: $
+ */
+public interface ConvertableEventFactory extends Component, ThreadSafe {
+
+    String ROLE = ConvertableEventFactory.class.getName();
+
+    /**
+     * Create an instance of the event
+     * @param service The PortalService
+     * @param eventData The marshalled data for this event.
+     * @return an instance of the event
+     */
+    ConvertableEvent createEvent(PortalService service, String eventData);
+}
\ No newline at end of file

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/EventConverter.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/EventConverter.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/EventConverter.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/EventConverter.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/EventConverter.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/EventConverter.java	Fri Jan 14 08:30:17 2005
@@ -52,4 +52,9 @@
      * This notifies the converter that an event processing phase ends
      */
     void finish();
+
+    /**
+     * Returns true if events are not to be returned as request parameters
+     */
+    boolean isMarshallEvents();
 }

Added: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/ConvertableEventAspect.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/ConvertableEventAspect.java?view=auto&rev=125181
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/ConvertableEventAspect.java	Fri Jan 14 08:30:17 2005
@@ -0,0 +1,113 @@
+/*
+ * Copyright 1999-2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.portal.event.aspect.impl;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.LinkService;
+import org.apache.cocoon.portal.event.Event;
+
+import org.apache.cocoon.portal.event.ConvertableEventFactory;
+import org.apache.cocoon.portal.event.ConvertableEvent;
+import org.apache.cocoon.portal.event.aspect.EventAspect;
+import org.apache.cocoon.portal.event.aspect.EventAspectContext;
+import org.apache.excalibur.source.SourceUtil;
+
+/**
+ * Process all convertable event request parameters, creating the events and saving
+ * them in request attributes for processing by EventAspects that follow.
+ *
+ * @author <a href="mailto:rgoers@apache.org">Ralph Goers</a>
+ * @version SVN $Id:  $
+ */
+public class ConvertableEventAspect extends AbstractLogEnabled
+	implements EventAspect, ThreadSafe, Serviceable {
+
+    protected ServiceManager manager;
+
+    public void service(ServiceManager manager) throws ServiceException
+    {
+        this.manager = manager;
+    }
+
+	/* (non-Javadoc)
+	 * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext, org.apache.cocoon.portal.PortalService)
+	 */
+	public void process(EventAspectContext context, PortalService service) {
+        final Request request = ObjectModelHelper.getRequest(context.getObjectModel());
+        final Parameters config = context.getAspectParameters();
+        final String parameterName = config.getParameter("parameter-name",
+            LinkService.DEFAULT_CONVERTABLE_EVENT_PARAMETER_NAME);
+
+        String[] parm = request.getParameterValues(parameterName);
+
+        if (parm != null) {
+            for (int i=0; i < parm.length; ++i) {
+                int index = parm[i].indexOf('(');
+                if (index > 0 && parm[i].endsWith(")")) {
+                    String eventKey = parm[i].substring(0, index);
+                    String eventParm =
+                        SourceUtil.decodePath(parm[i].substring(index+1, parm[i].length()-1));
+                    Event event = getEvent(service, eventKey, eventParm);
+                    String key = "org.apache.cocoon.portal." +
+                        ((ConvertableEvent)event).getRequestParameterName();
+                    List list = (List)request.getAttribute(key);
+                    if (list == null) {
+                        list = new ArrayList();
+                    }
+                    list.add(event);
+                    request.setAttribute(key, list);
+                }
+            }
+        }
+
+        context.invokeNext( service );
+	}
+
+    private ConvertableEvent getEvent(PortalService service, String factoryName, String eventData) {
+        ServiceSelector selector = null;
+        ConvertableEventFactory factory = null;
+        ConvertableEvent event;
+        try {
+            selector = (ServiceSelector) this.manager.lookup(ConvertableEventFactory.ROLE + "Selector");
+            factory = (ConvertableEventFactory) selector.select(factoryName);
+            event = factory.createEvent(service, eventData);
+        } catch (ServiceException ce) {
+            if (getLogger().isErrorEnabled()) {
+                getLogger().error("Unable to create event for " + factoryName +
+                    " using " + eventData);
+            }
+            event = null;
+        } finally {
+            if (selector != null) {
+                selector.release(factory);
+            }
+            this.manager.release(selector);
+        }
+        return event;
+    }
+}
\ No newline at end of file

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/FullScreenCopletEventAspect.java	Fri Jan 14 08:30:17 2005
@@ -36,6 +36,8 @@
 import org.apache.cocoon.portal.layout.Layout;
 import org.apache.cocoon.portal.layout.impl.CopletLayout;
 
+import java.util.List;
+
 /**
  *
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
@@ -78,6 +80,23 @@
                     FullScreenCopletEvent fsce = (FullScreenCopletEvent)e;
                     if ( fsce.getLayout() != null) {
                         service.getComponentManager().getLinkService().addEventToLink( e );
+                    }
+                }
+            }
+        } else {
+            List list = (List) request.getAttribute("org.apache.cocoon.portal." + requestParameterName);
+            if (list != null)
+            {
+                FullScreenCopletEvent[] events =
+                    (FullScreenCopletEvent[]) list.toArray(new FullScreenCopletEvent[0]);
+                final Publisher publisher = context.getEventPublisher();
+                for (int i = 0; i < events.length; i++)
+                {
+                    FullScreenCopletEvent e = events[i];
+                    publisher.publish(e);
+                    if (e.getLayout() != null)
+                    {
+                        service.getComponentManager().getLinkService().addEventToLink(e);
                     }
                 }
             }

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java	Fri Jan 14 08:30:17 2005
@@ -16,6 +16,7 @@
 package org.apache.cocoon.portal.event.aspect.impl;
 
 import java.util.StringTokenizer;
+import java.util.List;
 
 import org.apache.avalon.framework.logger.AbstractLogEnabled;
 import org.apache.avalon.framework.parameters.Parameters;
@@ -34,7 +35,7 @@
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
  * 
- * @version CVS $Id: RequestParameterEventAspect.java,v 1.4 2004/03/05 13:02:12 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class RequestParameterEventAspect
 	extends AbstractLogEnabled
@@ -49,6 +50,17 @@
                 final Event e = context.getEventConverter().decode(current);
                 if ( null != e) {
                     publisher.publish(e);
+                }
+            }
+        } else {
+            List list = (List) request.getAttribute("org.apache.cocoon.portal." + parameterName);
+            if (list != null)
+            {
+                Event[] events = (Event[]) list.toArray(new Event[0]);
+                final Publisher publisher = context.getEventPublisher();
+                for (int i = 0; i < events.length; i++)
+                {
+                    publisher.publish(events[i]);
                 }
             }
         }

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/DefaultEventConverter.java	Fri Jan 14 08:30:17 2005
@@ -33,7 +33,7 @@
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
  * 
- * @version CVS $Id: DefaultEventConverter.java,v 1.4 2004/03/05 13:02:12 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class DefaultEventConverter
     extends AbstractLogEnabled
@@ -133,5 +133,12 @@
         } finally {
             this.manager.release(service);
         }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.event.EventConverter#isMarshallEvents()
+     */
+    public boolean isMarshallEvents() {
+        return false;
     }
 }

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/FullScreenCopletEvent.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/FullScreenCopletEvent.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/FullScreenCopletEvent.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/FullScreenCopletEvent.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/FullScreenCopletEvent.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/FullScreenCopletEvent.java	Fri Jan 14 08:30:17 2005
@@ -17,7 +17,11 @@
 
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.event.RequestEvent;
+import org.apache.cocoon.portal.event.ConvertableEvent;
 import org.apache.cocoon.portal.layout.Layout;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.pluto.om.PortletWindowImpl;
+import org.apache.pluto.om.window.PortletWindow;
 
 /**
  * EventSource: copletID
@@ -25,11 +29,11 @@
  * @author <a href="mailto:cziegeler@s-und-n.de">Carsten Ziegeler</a>
  * @author <a href="mailto:volker.schmitt@basf-it-services.com">Volker Schmitt</a>
  * 
- * @version CVS $Id: FullScreenCopletEvent.java,v 1.2 2004/03/05 13:02:12 bdelacretaz Exp $
+ * @version CVS $Id$
  */
 public class FullScreenCopletEvent 
     extends CopletStatusEvent 
-    implements RequestEvent {
+    implements RequestEvent, ConvertableEvent {
 
     public static final String REQUEST_PARAMETER_NAME = "cocoon-portal-fs";
     
@@ -39,7 +43,26 @@
         this.coplet = data;
         this.layout = layout;
     }
-    
+
+    FullScreenCopletEvent(PortalService service, String eventData) {
+        int index = eventData.indexOf('_');
+        String copletId;
+        if (index > 0) {
+            copletId = eventData.substring(0, index);
+            this.coplet =
+                service.getComponentManager().getProfileManager().getCopletInstanceData(copletId);
+            if (eventData.length() > index + 1) {
+                String layoutId = eventData.substring(index + 1);
+                this.layout =
+                    service.getComponentManager().getProfileManager().getPortalLayout(null, layoutId);
+            }
+        } else {
+            this.layout = null;
+            this.coplet =
+                service.getComponentManager().getProfileManager().getCopletInstanceData(eventData);
+        }
+    }
+
     /* (non-Javadoc)
      * @see org.apache.cocoon.portal.event.RequestEvent#getRequestParameterName()
      */
@@ -51,4 +74,15 @@
         return this.layout;
     }
 
-}
+    public String asString() {
+        if (this.layout == null) {
+            return this.coplet.getId();
+        }
+        String layoutId = this.layout.getId();
+        if (layoutId == null) {
+            // Without a layout id this can't be marshalled.
+            return null;
+        }
+        return this.coplet.getId() + "_" + layoutId;
+    }
+}
\ No newline at end of file

Added: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/FullScreenCopletEventFactory.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/FullScreenCopletEventFactory.java?view=auto&rev=125181
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/FullScreenCopletEventFactory.java	Fri Jan 14 08:30:17 2005
@@ -0,0 +1,40 @@
+/*
+ * Copyright 1999-2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cocoon.portal.event.impl;
+
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.event.ConvertableEventFactory;
+import org.apache.cocoon.portal.event.ConvertableEvent;
+
+/**
+ * Factory to create FullScreenEvents from marshalled data.
+ *
+ * @author <a href="mailto:rgoers@apache.org">Ralph Goers</a>
+ * @version SVN $Id: $
+ */
+public class FullScreenCopletEventFactory implements ConvertableEventFactory {
+
+    /**
+     * Create an instance of the event
+     * @param service The PortalService
+     * @param eventData The marshalled data
+     * @return an instance of the event
+     */
+    public ConvertableEvent createEvent(PortalService service, String eventData) {
+        return new FullScreenCopletEvent(service, eventData);
+    }
+}
\ No newline at end of file

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/PageLabelEventConverter.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/PageLabelEventConverter.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/PageLabelEventConverter.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/PageLabelEventConverter.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/PageLabelEventConverter.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/event/impl/PageLabelEventConverter.java	Fri Jan 14 08:30:17 2005
@@ -124,4 +124,11 @@
     public void finish() {
         // nothing to do         
     }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.portal.event.EventConverter#isMarshallEvents()
+     */
+    public boolean isMarshallEvents() {
+        return this.labelManager.isMarshallEvents();
+    }
 }

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultLinkService.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultLinkService.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultLinkService.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultLinkService.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultLinkService.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/DefaultLinkService.java	Fri Jan 14 08:30:17 2005
@@ -37,6 +37,7 @@
 import org.apache.cocoon.portal.event.Event;
 import org.apache.cocoon.portal.event.EventConverter;
 import org.apache.cocoon.portal.event.RequestEvent;
+import org.apache.cocoon.portal.event.ConvertableEvent;
 import org.apache.excalibur.source.SourceUtil;
 
 /**
@@ -57,6 +58,11 @@
         StringBuffer  linkBase = new StringBuffer();
         boolean       hasParameters = false;
         ArrayList     comparableEvents = new ArrayList(5);
+
+        public String getBase(Boolean secure) {
+            //Todo actually implement secure
+            return linkBase.toString();
+        }
     }
     
     /** The converter used to convert an event into a request parameter */
@@ -65,7 +71,9 @@
     protected ServiceManager manager;
     /** The cocoon context */
     protected Context context;
-    
+
+    protected Boolean eventsMarshalled = null;
+
     /* (non-Javadoc)
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
@@ -98,35 +106,50 @@
         }
         return info;
     }
-    
+
+    /* (non-Javadoc)
+    * @see org.apache.cocoon.portal.LinkService#isSecure()
+    */
+    public boolean isSecure() {
+        return ContextHelper.getRequest(this.context).isSecure();
+    }
+
     /* (non-Javadoc)
      * @see org.apache.cocoon.portal.LinkService#getLinkURI(org.apache.cocoon.portal.event.Event)
      */
     public String getLinkURI(Event event) {
-        if ( event == null ) {
-            return this.getRefreshLinkURI();   
+        return this.getLinkURI(event, null);
+    }
+
+    /* (non-Javadoc)
+    * @see org.apache.cocoon.portal.LinkService#getLinkURI(org.apache.cocoon.portal.event.Event, boolean)
+    */
+    public String getLinkURI(Event event, Boolean secure) {
+        if (event == null) {
+            return this.getRefreshLinkURI();
         }
         final Info info = this.getInfo();
-        final StringBuffer buffer = new StringBuffer(info.linkBase.toString());
+        final StringBuffer buffer = new StringBuffer(info.getBase(secure));
         boolean hasParams = info.hasParameters;
 
         // add comparable events
-        final boolean comparableEvent = event instanceof ComparableEvent;        
+        final boolean comparableEvent = event instanceof ComparableEvent;
         Iterator iter = info.comparableEvents.iterator();
         while (iter.hasNext()) {
-            Object[] objects = (Object[])iter.next();
-            ComparableEvent current = (ComparableEvent)objects[0];
-            if ( !comparableEvent || !current.equalsEvent((ComparableEvent)event)) {
-                if ( hasParams ) {
+            Object[] objects = (Object[]) iter.next();
+            ComparableEvent current = (ComparableEvent) objects[0];
+            if (!comparableEvent || !current.equalsEvent((ComparableEvent) event)) {
+                if (hasParams) {
                     buffer.append('&');
-                } else {
+                }
+                else {
                     buffer.append('?');
                 }
-                buffer.append((String)objects[1]).append('=').append(SourceUtil.encode((String)objects[2]));
+                buffer.append((String) objects[1]).append('=').append(SourceUtil.encode((String) objects[2]));
                 hasParams = true;
             }
         }
-        
+
         // now add event
         hasParams = this.addEvent(buffer, event, hasParams);
 
@@ -143,15 +166,9 @@
         } else {
             buffer.append('?');
         }
-        String parameterName = DEFAULT_REQUEST_EVENT_PARAMETER_NAME;
-        if (event instanceof RequestEvent ) {
-            final String eventParName = ((RequestEvent)event).getRequestParameterName();
-            if ( eventParName != null ) {
-                parameterName = eventParName;
-            }
-        }
-        final String value = this.converter.encode( event );
-        buffer.append(parameterName).append('=').append(SourceUtil.encode(value));
+        StringBuffer value = new StringBuffer("");
+        String parameterName = processEvent(event, value);
+        buffer.append(parameterName).append('=').append(SourceUtil.encode(value.toString()));
         return true;
     }
     
@@ -159,53 +176,63 @@
      * @see org.apache.cocoon.portal.LinkService#getLinkURI(java.util.List)
      */
     public String getLinkURI(List events) {
-        if ( events == null || events.size() == 0) {
-            return this.getRefreshLinkURI();   
+        return this.getLinkURI(events, null);
+    }
+
+    /* (non-Javadoc)
+    * @see org.apache.cocoon.portal.LinkService#getLinkURI(java.util.List)
+    */
+    public String getLinkURI(List events, Boolean secure) {
+        if (events == null || events.size() == 0) {
+            return this.getRefreshLinkURI();
         }
         final Info info = this.getInfo();
         boolean hasParams = info.hasParameters;
-        final StringBuffer buffer = new StringBuffer(info.linkBase.toString());
-        
+        final StringBuffer buffer = new StringBuffer(info.getBase(secure));
+
         // add comparable events
         Iterator iter = info.comparableEvents.iterator();
         while (iter.hasNext()) {
-            Object[] objects = (Object[])iter.next();
-            ComparableEvent current = (ComparableEvent)objects[0];
-            
+            Object[] objects = (Object[]) iter.next();
+            ComparableEvent current = (ComparableEvent) objects[0];
+
             Iterator eventIterator = events.iterator();
             boolean found = false;
             while (!found && eventIterator.hasNext()) {
                 final Object inEvent = eventIterator.next();
-                if ( inEvent instanceof ComparableEvent
-                     && current.equalsEvent((ComparableEvent)inEvent)) {
-                     found = true;
+                if (inEvent instanceof ComparableEvent
+                    && current.equalsEvent((ComparableEvent) inEvent)) {
+                    found = true;
                 }
             }
             if (!found) {
-                if ( hasParams ) {
+                if (hasParams) {
                     buffer.append('&');
-                } else {
+                }
+                else {
                     buffer.append('?');
                 }
-                buffer.append((String)objects[1]).append('=').append(SourceUtil.encode((String)objects[2]));
+                buffer.append((String) objects[1]).append('=').append(SourceUtil.encode((String) objects[2]));
                 hasParams = true;
             }
         }
 
         // now add events
         iter = events.iterator();
-        while ( iter.hasNext()) {
+        while (iter.hasNext()) {
             final Object current = iter.next();
-            if ( current instanceof Event ) {
-                hasParams = this.addEvent(buffer, (Event)current, hasParams);
-            } else if ( current instanceof ParameterDescription ) {
-                if ( hasParams ) {
+            if (current instanceof Event) {
+                hasParams = this.addEvent(buffer, (Event) current, hasParams);
+            }
+            else if (current instanceof ParameterDescription) {
+                if (hasParams) {
                     buffer.append('&');
-                } else {
+                }
+                else {
                     buffer.append('?');
                     hasParams = true;
                 }
-                buffer.append(((ParameterDescription)current).parameters);
+                buffer.append(((ParameterDescription) current).parameters);
             }
         }
         return buffer.toString();
@@ -215,33 +242,27 @@
      * @see org.apache.cocoon.portal.LinkService#addEventToLink(org.apache.cocoon.portal.event.Event)
      */
     public void addEventToLink(Event event) {
-        if ( event == null ) {
-            return;   
-        }
-        String parameterName = DEFAULT_REQUEST_EVENT_PARAMETER_NAME;
-        if (event instanceof RequestEvent ) {
-            final String eventParName = ((RequestEvent)event).getRequestParameterName();
-            if ( eventParName != null ) {
-                parameterName = eventParName;
-            }
+        if (event == null) {
+            return;
         }
-        final String value = this.converter.encode( event );
+        StringBuffer value = new StringBuffer("");
+        String parameterName = processEvent(event, value);
 
         final Info info = this.getInfo();
-        if ( event instanceof ComparableEvent) {
+        if (event instanceof ComparableEvent) {
             // search if we already have an event for this!
             final Iterator iter = info.comparableEvents.iterator();
             boolean found = false;
-            while ( !found && iter.hasNext() ) {
+            while (!found && iter.hasNext()) {
                 Object[] objects = (Object[])iter.next();
-                if ( ((ComparableEvent)objects[0]).equalsEvent((ComparableEvent)event) ) {
+                if (((ComparableEvent) objects[0]).equalsEvent((ComparableEvent) event)) {
                     found = true;
                     info.comparableEvents.remove(objects);
                 }
             }
-            info.comparableEvents.add( new Object[] {event, parameterName, value} );
+            info.comparableEvents.add(new Object[]{event, parameterName, value.toString()});
         } else {
-            this.addParameterToLink(parameterName, value);
+            this.addParameterToLink(parameterName, value.toString());
         }
     }
 
@@ -322,7 +343,6 @@
             this.converter = null;
             this.manager = null;
         }
-
     }
 
     /* (non-Javadoc)
@@ -332,4 +352,40 @@
         this.context = context;
     }
 
-}
+    private boolean getEventsMarshalled() {
+        if (this.eventsMarshalled == null) {
+            this.eventsMarshalled = new Boolean(this.converter.isMarshallEvents());
+        }
+        return this.eventsMarshalled.booleanValue();
+    }
+
+    private String processEvent(Event event, StringBuffer value) {
+        String parameterName = DEFAULT_REQUEST_EVENT_PARAMETER_NAME;
+        if (event instanceof ConvertableEvent && getEventsMarshalled()) {
+            final String eventParName = ((ConvertableEvent) event).getRequestParameterName();
+            String eventStr = ((ConvertableEvent) event).asString();
+            if (eventStr == null) {
+                // Could not convert the event
+                value.append(this.converter.encode(event));
+            } else {
+                String eventValue;
+                parameterName = DEFAULT_CONVERTABLE_EVENT_PARAMETER_NAME;
+                try {
+                    eventValue = SourceUtil.encode(eventStr, "utf-8");
+                } catch (Exception e) {
+                    eventValue = SourceUtil.encode(eventStr);
+                }
+                value.append(eventParName).append('(').append(eventValue).append(')');
+            }
+        } else {
+            if (event instanceof RequestEvent) {
+                final String eventParName = ((RequestEvent) event).getRequestParameterName();
+                if (eventParName != null) {
+                    parameterName = eventParName;
+                }
+            }
+            value.append(this.converter.encode(event));
+        }
+        return parameterName;
+    }
+}
\ No newline at end of file

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelLinkService.java	Fri Jan 14 08:30:17 2005
@@ -57,6 +57,17 @@
      * @return A URI
      */
     public String getLinkURI(Event event) {
+        return getLinkURI(event, null);
+    }
+
+    /**
+     * Get the uri for the coplet containing event
+     *
+     * @param event The event to find
+     * @param secure true if a secure protocol is required, false otherwise.
+     * @return A URI
+     */
+    public String getLinkURI(Event event, Boolean secure) {
         if (event == null) {
             return this.getRefreshLinkURI();
         }
@@ -81,7 +92,7 @@
                 if (this.labelManager.getPageLabelEvents(key.toString()) != null) {
                     final Info info = this.getInfo();
                     boolean hasParams = info.hasParameters;
-                    final StringBuffer buffer = new StringBuffer(info.linkBase.toString());
+                    final StringBuffer buffer = new StringBuffer(info.getBase(secure));
                     if (hasParams) {
                         buffer.append('&');
                     }
@@ -102,7 +113,17 @@
 
         String label = this.labelManager.getCurrentLabel();
 
-        return getLink(super.getLinkURI(event), requestParameterName, label);
+        return getLink(super.getLinkURI(event, secure), requestParameterName, label);
+    }
+
+    /**
+     * Get the uri for this coplet containing the additional events.
+     *
+     * @param events The events that will be processed by the generated uri.
+     * @return A URI
+     */
+    public String getLinkURI(List events) {
+        return getLinkURI(events, null);
     }
 
     /**
@@ -111,8 +132,7 @@
      * @param events The events that will be processed by the generated uri.
      * @return A URI
      */
-    public String getLinkURI(List events)
-    {
+    public String getLinkURI(List events, Boolean secure) {
         if (events == null || events.size() == 0) {
             return this.getRefreshLinkURI();
         }
@@ -122,7 +142,7 @@
 
         String requestParameterName = this.labelManager.getRequestParameterName();
         final Info info = this.getInfo();
-        final StringBuffer buffer = new StringBuffer(info.linkBase.toString());
+        final StringBuffer buffer = new StringBuffer(info.getBase(secure));
         boolean hasParams = info.hasParameters;
         Iterator iter = events.iterator();
         StringBuffer value = new StringBuffer("");
@@ -152,7 +172,7 @@
             else {
                 String label = this.labelManager.getCurrentLabel();
 
-                return getLink(super.getLinkURI(events), requestParameterName, label);
+                return getLink(super.getLinkURI(events, secure), requestParameterName, label);
             }
         }
 

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelManager.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelManager.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelManager.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelManager.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelManager.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PageLabelManager.java	Fri Jan 14 08:30:17 2005
@@ -67,6 +67,7 @@
     protected String aspectName = null;
     private String requestParameterName;
     private boolean nonStickyTabs;
+    private boolean marshallEvents;
 
     protected static final String LABEL_ARRAY = PageLabelManager.class.getName() + "A";
     protected static final String LABEL_MAP = PageLabelManager.class.getName() + "M";
@@ -91,6 +92,8 @@
         this.aspectName = config.getChild("aspectName").getValue("tab");
         this.nonStickyTabs =
             Boolean.valueOf(config.getChild("nonStickyTabs").getValue("false")).booleanValue();
+        this.marshallEvents =
+            Boolean.valueOf(config.getChild("marshallEvents").getValue("false")).booleanValue();
     }
 
     /* (non-Javadoc)
@@ -203,6 +206,13 @@
         finally {
             this.manager.release(service);
         }
+    }
+
+    /**
+     * Returns true if events are not to be exposed as request parameters
+     */
+    public boolean isMarshallEvents() {
+        return this.marshallEvents;
     }
 
     /*

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortalManagerImpl.java	Fri Jan 14 08:30:17 2005
@@ -80,6 +80,13 @@
             contentHandler.endDocument();
         } catch (ServiceException ce) {
             throw new SAXException("Unable to lookup portal service.", ce);
+        } catch (Exception e) {
+            getLogger().error("Caught exception", e);
+            throw new SAXException(e);
+        } catch (Error e) {
+            getLogger().error("Caught error", e);
+            e.printStackTrace();
+            throw e;
         } finally {
             this.manager.release(service);
         }

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/AbstractLayout.java	Fri Jan 14 08:30:17 2005
@@ -41,7 +41,14 @@
     protected Item parent;
     
     protected Map parameters = new LinkedMap();
-     
+
+    /*
+     * Default constructor
+     */
+    public AbstractLayout() {
+        
+    }
+
     /* (non-Javadoc)
      * @see org.apache.cocoon.portal.layout.Parameters#getParameters()
      */

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/layout/impl/CopletLayout.java	Fri Jan 14 08:30:17 2005
@@ -34,6 +34,10 @@
     
     public void setCopletInstanceData(CopletInstanceData cid) {
         this.copletInstanceData = cid;
+        String id = cid.getId();
+        if (id != null) {
+            this.setId(cid.getId());
+        }
     }
     
     public CopletInstanceData getCopletInstanceData() {

Added: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLConverter.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLConverter.java?view=auto&rev=125181
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLConverter.java	Fri Jan 14 08:30:17 2005
@@ -0,0 +1,295 @@
+/*
+ * Copyright 2003,2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cocoon.portal.pluto;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+
+import org.apache.pluto.util.StringUtils;
+import org.apache.cocoon.portal.coplet.CopletInstanceData;
+
+/**
+ * Create the URL for a portlet
+ *
+ * @author <a href="mailto:rgoers@apache.org">Ralph Goers</a>
+ * @version SVN $Id: $
+ */
+
+public class PortletURLConverter {
+
+    public static final String ACTION = "ac";
+    public static final String MODE = "md";
+    public static final String PORTLET_ID = "pid";
+    public static final String PREFIX = "_";
+    public static final String PARAM = "pm";
+    public static final String STATE = "st";
+
+    private Map urlData = new HashMap();
+    private Map parameters = new HashMap();
+    private String portletId = null;
+
+    /**
+     * Constructor used when the URL will be marshalled.
+     * @param cid The coplet id.
+     */
+    public PortletURLConverter(CopletInstanceData cid) {
+        this.portletId = cid.getId();
+    }
+
+    /**
+     * Constructor used when the URL will be unmarshalled.
+     * @param eventData The url data.
+     */
+    public PortletURLConverter(String eventData) {
+        StringTokenizer tokenizer = new StringTokenizer(eventData, "/");
+        while (tokenizer.hasMoreTokens()) {
+            String token = tokenizer.nextToken();
+            if (isParameter(token)) {
+                String name = decodeParameterName(token);
+                String key = encodeParameterName(name);
+                this.parameters.put(key, token.substring(key.length()));
+            } else {
+                StringTokenizer tokens = new StringTokenizer(token, PREFIX);
+
+                if (tokens.countTokens() > 1) {
+                    String key = tokens.nextToken();
+                    if (key.equals(PORTLET_ID)) {
+                        this.portletId = tokens.nextToken();
+                    } else {
+                        String value = tokens.nextToken();
+                        urlData.put(key, value);
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Return the PortletMode
+     * @return The PortletMode
+     */
+    public PortletMode getMode()
+    {
+        String mode = (String)urlData.get(getModeKey());
+        if (mode!=null) {
+            return new PortletMode(mode);
+        } else {
+            return PortletMode.VIEW;
+        }
+    }
+
+    /**
+     * Return the WindowState
+     * @return The WindowState
+     */
+    public WindowState getState() {
+        String state = (String) urlData.get(getStateKey());
+        if (state != null) {
+            return new WindowState(state);
+        }
+        else {
+            return WindowState.NORMAL;
+        }
+    }
+
+    /**
+     * Return the indicator if this is an action.
+     * @return true if this is an action URL, false if a render URL.
+     */
+    public boolean isAction() {
+        return (urlData.get(getActionKey()) != null);
+    }
+
+    /**
+     * Indicates that the URL is an action.
+     */
+    public void setAction()
+    {
+        urlData.put(getActionKey(),ACTION.toUpperCase());
+    }
+
+    /**
+     * Sets the PortletMode.
+     * @param mode The PortletMode
+     */
+    public void setMode(PortletMode mode)
+    {
+        urlData.put(getModeKey(), mode.toString());
+    }
+
+    /**
+     * Sets the WindowState
+     * @param state The WindowState
+     */
+    public void setState(WindowState state) {
+        urlData.put(getStateKey(), state.toString());
+    }
+
+    /**
+     * Returns the portlet id.
+     * @return The portlet id.
+     */
+    public String getPortletId() {
+        return this.portletId;
+    }
+
+    /**
+     * Returns the request parameters for this portlet URL.
+     * @return A Map containing the parameters for this URL.
+     */
+    public Map getParameters() {
+        Map map = new HashMap();
+        Iterator iter = this.parameters.entrySet().iterator();
+        while (iter.hasNext()) {
+            Map.Entry entry = (Map.Entry)iter.next();
+            String key = decodeParameterName((String) entry.getKey());
+            String[] values = decodeParameterValues((String)entry.getValue());
+            map.put(key, values);
+        }
+        return map;
+    }
+
+    /**
+     * Adds the parameter, replacing a parameter with the same name.
+     * @param name The parameter name
+     * @param values An array of Strings.
+     */
+    public void setParam(String name, String[] values)
+    {
+        this.parameters.put(encodeParameterName(name), encodeParameterValues(values));
+    }
+
+    /**
+     * Returns the marshalled URL.
+     * @return A String containing the marshalled URL.
+     */
+    public String toString() {
+        StringBuffer buffer = new StringBuffer("");
+        buffer.append(PORTLET_ID).append(PREFIX).append(portletId);
+        Iterator iter = urlData.entrySet().iterator();
+        while (iter.hasNext()) {
+            buffer.append("/");
+            Map.Entry entry = (Map.Entry)iter.next();
+            buffer.append(entry.getKey()).append(PREFIX).append(entry.getValue());
+        }
+        iter = this.parameters.entrySet().iterator();
+        while (iter.hasNext()) {
+            buffer.append("/");
+            Map.Entry entry = (Map.Entry) iter.next();
+            buffer.append(entry.getKey()).append(PREFIX).append(entry.getValue());
+        }
+        return buffer.toString();
+    }
+
+    private String getActionKey() {
+        return ACTION;
+    }
+
+    private String getModeKey() {
+        return MODE;
+    }
+
+    private String getStateKey() {
+        return STATE;
+    }
+
+    private String getParamKey() {
+        return PARAM + PREFIX;
+    }
+
+    private boolean isParameter(String key) {
+        return key.startsWith(getParamKey());
+    }
+
+    private String decodeParameterName(String encodedParamName) {
+        StringTokenizer tokenizer = new StringTokenizer(encodedParamName, PREFIX);
+        if (!tokenizer.hasMoreTokens()) {
+            return null;
+        }
+        // Skip the key
+        tokenizer.nextToken();
+        if (!tokenizer.hasMoreTokens()) {
+            return null;
+        }
+        String name = tokenizer.nextToken();
+        return decodeValue(name);
+    }
+
+    private String[] decodeParameterValues(String encodedParamValues) {
+        StringTokenizer tokenizer = new StringTokenizer(encodedParamValues, PREFIX);
+        if (!tokenizer.hasMoreTokens()) {
+            return null;
+        }
+        String _count = tokenizer.nextToken();
+        int count = Integer.valueOf(_count).intValue();
+        String[] values = new String[count];
+        for (int i = 0; i < count; i++) {
+            if (!tokenizer.hasMoreTokens()) {
+                return null;
+            }
+            values[i] = decodeValue(tokenizer.nextToken());
+        }
+        return values;
+    }
+
+    private String decodeValue(String value) {
+        value = StringUtils.replace(value, "0x1", "_");
+        value = StringUtils.replace(value, "0x2", ".");
+        value = StringUtils.replace(value, "0x3", "/");
+        value = StringUtils.replace(value, "0x4", "\r");
+        value = StringUtils.replace(value, "0x5", "\n");
+        value = StringUtils.replace(value, "0x6", "<");
+        value = StringUtils.replace(value, "0x7", ">");
+        value = StringUtils.replace(value, "0x8", " ");
+        value = StringUtils.replace(value, "0x0", "0x");
+        return value;
+    }
+
+    private String encodeParameterName(String paramName) {
+        StringBuffer returnvalue = new StringBuffer(50);
+        returnvalue.append(getParamKey()).append(encodeValue(paramName));
+        return returnvalue.toString();
+    }
+
+    private String encodeParameterValues(String[] paramValues) {
+        StringBuffer returnvalue = new StringBuffer(100);
+        returnvalue.append(paramValues.length);
+        for (int i = 0; i < paramValues.length; i++) {
+            returnvalue.append("_");
+            returnvalue.append(encodeValue(paramValues[i]));
+        }
+        return returnvalue.toString();
+    }
+
+    private String encodeValue(String value) {
+        value = StringUtils.replace(value, "0x", "0x0");
+        value = StringUtils.replace(value, "_", "0x1");
+        value = StringUtils.replace(value, ".", "0x2");
+        value = StringUtils.replace(value, "/", "0x3");
+        value = StringUtils.replace(value, "\r", "0x4");
+        value = StringUtils.replace(value, "\n", "0x5");
+        value = StringUtils.replace(value, "<", "0x6");
+        value = StringUtils.replace(value, ">", "0x7");
+        value = StringUtils.replace(value, " ", "0x8");
+        return value;
+    }
+}
\ No newline at end of file

Added: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLProviderFactory.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLProviderFactory.java?view=auto&rev=125181
==============================================================================
--- (empty file)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLProviderFactory.java	Fri Jan 14 08:30:17 2005
@@ -0,0 +1,42 @@
+/*
+ * Copyright 1999-2002,2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.cocoon.portal.pluto;
+
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.event.ConvertableEventFactory;
+import org.apache.cocoon.portal.event.ConvertableEvent;
+import org.apache.cocoon.portal.event.impl.FullScreenCopletEventFactory;
+import org.apache.cocoon.portal.event.impl.FullScreenCopletEvent;
+
+/**
+ * Factory to create PortletURLProviderImpl objects from marshalled data
+ *
+ * @author <a href="mailto:rgoers@apache.org">Ralph Goers</a>
+ * @version SVN $Id: $
+ */
+public class PortletURLProviderFactory implements ConvertableEventFactory {
+
+    /**
+     * Create an instance of the event.
+     * @param service The PortalService.
+     * @param eventData The marshalled data.
+     * @return a PortletURLProviderImpl
+     */
+    public ConvertableEvent createEvent(PortalService service, String eventData) {
+        return new PortletURLProviderImpl(service, eventData);
+    }
+}
\ No newline at end of file

Modified: cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java
Url: http://svn.apache.org/viewcvs/cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java?view=diff&rev=125181&p1=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java&r1=125180&p2=cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java&r2=125181
==============================================================================
--- cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java	(original)
+++ cocoon/trunk/src/blocks/portal/java/org/apache/cocoon/portal/pluto/PortletURLProviderImpl.java	Fri Jan 14 08:30:17 2005
@@ -20,6 +20,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.HashMap;
+import java.util.Iterator;
 
 import javax.portlet.PortletMode;
 import javax.portlet.WindowState;
@@ -32,6 +33,7 @@
 import org.apache.cocoon.portal.coplet.CopletInstanceData;
 import org.apache.cocoon.portal.event.CopletInstanceEvent;
 import org.apache.cocoon.portal.event.Event;
+import org.apache.cocoon.portal.event.ConvertableEvent;
 import org.apache.cocoon.portal.event.impl.FullScreenCopletEvent;
 import org.apache.cocoon.portal.layout.impl.CopletLayout;
 import org.apache.cocoon.portal.pluto.om.PortletEntityImpl;
@@ -47,10 +49,7 @@
  * @version CVS $Id$
  */
 public class PortletURLProviderImpl 
-       implements PortletURLProvider, CopletInstanceEvent {
-
-    /** The service manager */
-    protected final ServiceManager manager;
+       implements PortletURLProvider, CopletInstanceEvent, ConvertableEvent {
     
     /** The portlet window (target) */
     protected final PortletWindow portletWindow;
@@ -65,7 +64,7 @@
     protected boolean action;
     
     /** Secure link? */
-    protected boolean secure;
+    protected Boolean secure = null;
     
     /** Clear parameters */
     protected boolean clearParameters;
@@ -75,21 +74,51 @@
     
     /** The generated url */
     protected String generatedURL;
-    
+    private LinkService linkService;
+    private static final String DEFAULT_PORTLET_URL_REQUEST_PARAM = "url";
+
     /**
      * Constructor
      */
     public PortletURLProviderImpl(PortletWindow portletWindow,
                                   ServiceManager manager) {
-        this.manager = manager;
         this.portletWindow = portletWindow;
+        PortalService service = null;
+        try {
+            service = (PortalService) manager.lookup(PortalService.ROLE);
+            this.linkService = service.getComponentManager().getLinkService();
+        } catch (ServiceException se) {
+            throw new CascadingRuntimeException("Unable to lookup portal service.", se);
+        } finally {
+            manager.release(service);
+        }
+    }
+
+    /**
+     * Constructor for factory
+     * @param service
+     * @param eventData
+     */
+    PortletURLProviderImpl(PortalService service, String eventData) {
+        this.linkService = service.getComponentManager().getLinkService();
+        PortletURLConverter urlConverter = new PortletURLConverter(eventData);
+        String copletId = urlConverter.getPortletId();
+        CopletInstanceData cid = service.getComponentManager().getProfileManager()
+            .getCopletInstanceData(copletId);
+        this.portletWindow = (PortletWindow)cid.getTemporaryAttribute("window");
+        this.mode = urlConverter.getMode();
+        this.state = urlConverter.getState();
+        this.action = urlConverter.isAction();
+        this.parameters = urlConverter.getParameters();
+        this.clearParameters = false;
+        this.secure = null;
     }
 
     /**
      * Copy constructor
      */
     private PortletURLProviderImpl(PortletURLProviderImpl original) {
-        this.manager = original.manager;
+        this.linkService = original.linkService;
         this.portletWindow = original.portletWindow;
         this.mode = original.mode;
         this.state = original.state;
@@ -156,7 +185,7 @@
      * @see org.apache.pluto.services.information.PortletURLProvider#setSecure()
      */
     public void setSecure() {
-        this.secure = true;
+        this.secure =  new Boolean(true);
     }
 
     /* (non-Javadoc)
@@ -211,23 +240,16 @@
                     }
                 }
             }
-            PortalService service = null;
-            try {
-                service = (PortalService) this.manager.lookup(PortalService.ROLE);
-                LinkService linkService = service.getComponentManager().getLinkService();
-                
-                //TODO - secure
-                List l = new ArrayList();
-                if ( sizingEvent != null ) {
-                    l.add(sizingEvent);
-                }
-                l.add(this);
-                this.generatedURL = linkService.getLinkURI(l);
-                
-            } catch (ServiceException se) {
-                throw new CascadingRuntimeException("Unable to lookup portal service.", se);
-            } finally {
-                this.manager.release(service);
+
+            List l = new ArrayList();
+            if ( sizingEvent != null ) {
+                l.add(sizingEvent);
+            }
+            l.add(this);
+            if (secure == null) {
+                this.generatedURL = this.linkService.getLinkURI(l);
+            } else {
+                this.generatedURL = this.linkService.getLinkURI(l, secure);
             }
         }
         return this.generatedURL;
@@ -238,6 +260,57 @@
      */
     public Object getTarget() {        
         return ((PortletEntityImpl)this.portletWindow.getPortletEntity()).getCopletInstanceData();
+    }
+
+    /**
+     * Return the URL as a String
+     *
+     * @return The URL as a String
+     */
+    public String asString() {
+
+        final PortletWindowImpl impl = (PortletWindowImpl) this.portletWindow;
+        final CopletLayout cl = impl.getLayout();
+        if (cl == null) {
+            return "";
+        }
+        final CopletInstanceData cid = cl.getCopletInstanceData();
+        PortletURLConverter urlConverter = new PortletURLConverter(cid);
+
+        if (this.mode != null) {
+            urlConverter.setMode(this.mode);
+        }
+
+        if (this.state != null) {
+            urlConverter.setState(this.state);
+        }
+
+        if (this.action) {
+            urlConverter.setAction();
+        }
+
+        if (this.parameters != null) {
+            Iterator entries = this.parameters.entrySet().iterator();
+            while (entries.hasNext()) {
+                Map.Entry entry = (Map.Entry)entries.next();
+                String name = (String) entry.getKey();
+                Object value = entry.getValue();
+                String[] values = value instanceof String ?
+                    new String[]{(String) value} : (String[]) value;
+                urlConverter.setParam(name, values);
+            }
+        }
+
+        return urlConverter.toString();
+    }
+
+    /**
+     * The request parameter to be used for this event (if events are not hidden)
+     *
+     * @return The request parameter name for this event.
+     */
+    public String getRequestParameterName() {
+        return DEFAULT_PORTLET_URL_REQUEST_PARAM;
     }
 
 }

Modified: cocoon/trunk/status.xml
Url: http://svn.apache.org/viewcvs/cocoon/trunk/status.xml?view=diff&rev=125181&p1=cocoon/trunk/status.xml&r1=125180&p2=cocoon/trunk/status.xml&r2=125181
==============================================================================
--- cocoon/trunk/status.xml	(original)
+++ cocoon/trunk/status.xml	Fri Jan 14 08:30:17 2005
@@ -457,6 +457,10 @@
    </action>
  </release>
  <release version="2.1.7" date="TBD">
+   <action dev="RG" type="fix" fixes-bug="33091">
+      Refreshing a page with a JSR-168 portlet in it could cause unexpected results. JSR-168 urls can
+      now be configured to contain the data required to generated the required events.
+   </action>
    <action dev="RG" type="fix" fixes-bug="32838" due-to="Roy Huang" due-to-email="lingererhuang@hotmail.com">
      PageLabel url's were not properly encoded.
    </action>

Mime
View raw message