You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2007/02/23 15:26:26 UTC

svn commit: r510953 - in /cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects: ./ impl/ impl/support/

Author: cziegeler
Date: Fri Feb 23 06:26:25 2007
New Revision: 510953

URL: http://svn.apache.org/viewvc?view=rev&rev=510953
Log:
Start new request processor aspect

Added:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspect.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspectContext.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/AbstractContentRequestProcessorAspect.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/ActionCounterRequestProcessorAspect.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/FrameRequestProcessorAspect.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/LinkRequestProcessorAspect.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/NoClientCachingRequestProcessorAspect.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/RequestParameterRequestProcessorAspect.java   (with props)
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/RequestProcessorAspectContextImpl.java   (with props)

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspect.java?view=auto&rev=510953
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspect.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspect.java Fri Feb 23 06:26:25 2007
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.services.aspects;
+
+import org.apache.cocoon.portal.PortalException;
+
+/**
+ * This aspect can be used to add additional behaviour to the request processing
+ * phase.
+ *
+ * @version $Id$
+ */
+public interface RequestProcessorAspect {
+
+    void process(RequestProcessorAspectContext context)
+    throws PortalException;
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspectContext.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspectContext.java?view=auto&rev=510953
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspectContext.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspectContext.java Fri Feb 23 06:26:25 2007
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.services.aspects;
+
+import org.apache.cocoon.portal.PortalException;
+
+/**
+ * The context for a {@link RequestProcessorAspect}.
+ *
+ * @version $Id$
+ */
+public interface RequestProcessorAspectContext
+    extends BasicAspectContext {
+
+    /**
+     * Invoke next aspect in the chain.
+     */
+    void invokeNext()
+    throws PortalException;
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspectContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/RequestProcessorAspectContext.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/AbstractContentRequestProcessorAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/AbstractContentRequestProcessorAspect.java?view=auto&rev=510953
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/AbstractContentRequestProcessorAspect.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/AbstractContentRequestProcessorAspect.java Fri Feb 23 06:26:25 2007
@@ -0,0 +1,124 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.services.aspects.impl;
+
+import java.util.StringTokenizer;
+
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.event.Event;
+import org.apache.cocoon.portal.event.EventManager;
+import org.apache.cocoon.portal.event.aspect.EventAspect;
+import org.apache.cocoon.portal.event.aspect.EventAspectContext;
+import org.apache.cocoon.portal.om.Layout;
+import org.apache.cocoon.portal.om.LayoutException;
+import org.apache.cocoon.portal.util.AbstractBean;
+
+/**
+ *
+ * @version $Id$
+ */
+public abstract class AbstractContentRequestProcessorAspect
+    extends AbstractBean
+    implements EventAspect {
+
+    protected abstract String getRequestParameterName(EventAspectContext context);
+
+    protected abstract int getRequiredValueCount();
+
+    /**
+     * Custom publishing of an event.
+     * The real values for the event are contained in the array
+     * starting with index 1!
+     * @param layout  The corresponding layout
+     * @param values  The values contained in the request
+     */
+    protected abstract void publish(PortalService service, Layout layout, String[] values)
+    throws LayoutException;
+
+    /**
+     * Publish the event.
+     * This method gets the layout object from the first
+     * value and invokes {@link #publish(EventManager, Layout, String[])}.
+     * @param values The values contained in the request
+     */
+    protected void publish( PortalService service, String[] values) {
+        final Layout layout = service.getProfileManager().getLayout(values[0] );
+        if ( layout != null ) {
+            try {
+                this.publish( service, layout, values);
+            } catch (Exception e) {
+                this.getLogger().warn("Unable to publish event. Ignoring exception.", e);
+            }
+        }
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext)
+     */
+    public void process(EventAspectContext context) {
+        final Request request = ObjectModelHelper.getRequest(context.getPortalService().getProcessInfoProvider().getObjectModel());
+        String[] values = request.getParameterValues(this.getRequestParameterName(context));
+        if (values != null) {
+            final EventManager publisher = context.getPortalService().getEventManager();
+            for (int i = 0; i < values.length; i++) {
+                // first try to make an event out of the value of the parameter
+                final String value = values[i];
+                Event e = null;
+                try {
+                    e = context.getPortalService().getEventConverter().decode(value);
+                    if (null != e) {
+                        publisher.send(e);
+                    }
+                } catch (Exception ignore) {
+                    // ignroe it
+                }
+                // the event could not be generated, so try different approach
+                if (e == null) {
+                    // Use '|' character as delimiter between Group, ID and URI
+					StringTokenizer tokenizer = new StringTokenizer(value, "|");
+					int tokenNumber = 0;
+					int tokenCount = tokenizer.countTokens();
+					// if only 2 params are in the String
+                    // the groupKey is missing and defaults to null
+					if (tokenCount == this.getRequiredValueCount()-1) {
+                        tokenNumber = tokenNumber + 1;
+                        tokenCount++;
+					}
+
+                    if ( tokenCount == this.getRequiredValueCount() ) {
+                        String [] eventValues = new String[tokenCount];
+                                        
+                        while (tokenizer.hasMoreTokens()) {
+                            eventValues[tokenNumber] = tokenizer.nextToken();
+                        
+                            tokenNumber = tokenNumber + 1;
+                        } 
+
+                        this.publish( context.getPortalService(), eventValues );
+
+                    } else {
+                        this.getLogger().warn("Data for Event is not set correctly");
+                    }
+                }
+            }
+        }
+        // and invoke next one
+        context.invokeNext();
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/AbstractContentRequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/AbstractContentRequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/ActionCounterRequestProcessorAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/ActionCounterRequestProcessorAspect.java?view=auto&rev=510953
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/ActionCounterRequestProcessorAspect.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/ActionCounterRequestProcessorAspect.java Fri Feb 23 06:26:25 2007
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.services.aspects.impl;
+
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.environment.Response;
+import org.apache.cocoon.portal.event.aspect.EventAspect;
+import org.apache.cocoon.portal.event.aspect.EventAspectContext;
+import org.apache.cocoon.portal.util.AbstractBean;
+
+/**
+ * This aspect "disables" the back button of the browser and tries to avoid
+ * problems with the user browsing in multiple windows.
+ * This event attaches a unique number to each request. For each user only the
+ * current number is "active". Every request comming in containing an older
+ * number is disregarded and therefore ignored.
+ * WARNING: This aspect solves some problems while introducing new ones. Some
+ *          features of the portal do NOT work when this aspect is used.
+ *
+ * @version $Id$
+ */
+public class ActionCounterRequestProcessorAspect
+	extends AbstractBean
+	implements EventAspect {
+
+    protected final static String ATTRIBUTE_NAME = ActionCounterRequestProcessorAspect.class.getName();
+
+    /** The name of the parameter to check */
+    protected String parameterName = "cocoon-portal-action";
+
+	/**
+	 * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext)
+	 */
+	public void process(EventAspectContext context) {
+        final String requestParameterName = context.getAspectProperties().getProperty("parameter-name", this.parameterName);
+
+        int actionCount;
+
+        Integer actionValue = (Integer) context.getPortalService().getUserService().getAttribute(ATTRIBUTE_NAME);
+        if (null == actionValue) {
+            actionValue = new Integer(0);
+            context.getPortalService().getUserService().setAttribute(ATTRIBUTE_NAME, actionValue);
+            actionCount = 0;
+        } else {
+            actionCount = actionValue.intValue() + 1;
+            context.getPortalService().getUserService().setAttribute(ATTRIBUTE_NAME, new Integer(actionCount));
+        }
+
+        final Request request = ObjectModelHelper.getRequest( context.getPortalService().getProcessInfoProvider().getObjectModel() );
+        String value = request.getParameter( requestParameterName );
+        if ( value != null && actionCount > 0) {
+            // get number
+            int number = 0;
+            try {
+                number = Integer.parseInt( value );
+            } catch (Exception ignore) {
+                number = -1;
+            }
+
+            if ( number == actionCount - 1) {
+                // and invoke next one
+                context.invokeNext();
+            }
+        }
+        context.getPortalService().getLinkService().addUniqueParameterToLink( requestParameterName, String.valueOf(actionCount));
+
+        final Response response = ObjectModelHelper.getResponse( context.getPortalService().getProcessInfoProvider().getObjectModel() );
+        response.setHeader("Cache-Control", "no-cache");
+        response.addHeader("Cache-Control", "no-store");
+        response.setHeader("Pragma", "no-cache");
+        response.setHeader("Expires", "Thu, 01 Jan 2000 00:00:00 GMT");
+	}
+
+    public void setParameterName(String value) {
+        this.parameterName = value;
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/ActionCounterRequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/ActionCounterRequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/FrameRequestProcessorAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/FrameRequestProcessorAspect.java?view=auto&rev=510953
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/FrameRequestProcessorAspect.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/FrameRequestProcessorAspect.java Fri Feb 23 06:26:25 2007
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.services.aspects.impl;
+
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.event.Event;
+import org.apache.cocoon.portal.event.aspect.EventAspectContext;
+import org.apache.cocoon.portal.event.layout.LayoutInstanceChangeAttributeEvent;
+import org.apache.cocoon.portal.om.FrameLayout;
+import org.apache.cocoon.portal.om.Layout;
+import org.apache.cocoon.portal.om.LayoutException;
+import org.apache.cocoon.portal.om.LayoutFeatures;
+import org.apache.cocoon.portal.om.LayoutInstance;
+
+/**
+ *
+ * @version $Id$
+ */
+public class FrameRequestProcessorAspect extends AbstractContentRequestProcessorAspect {
+
+    /**
+     * @see org.apache.cocoon.portal.event.aspect.impl.AbstractContentEventAspect#getRequestParameterName(org.apache.cocoon.portal.event.aspect.EventAspectContext)
+     */
+    protected String getRequestParameterName(EventAspectContext context) {
+        return context.getAspectProperties().getProperty("parameter-name", "frame");
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.event.aspect.impl.AbstractContentEventAspect#getRequiredValueCount()
+     */
+    protected int getRequiredValueCount() {
+        return 2;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.event.aspect.impl.AbstractContentEventAspect#publish(PortalService, org.apache.cocoon.portal.om.Layout, java.lang.String[])
+     */
+    protected void publish(PortalService service,
+                           Layout        layout,
+                           String[]      values)
+    throws LayoutException {
+        LayoutFeatures.checkLayoutClass(layout, FrameLayout.class, true);
+        final LayoutInstance instance = LayoutFeatures.getLayoutInstance(service, layout, true);
+        final Event e = new LayoutInstanceChangeAttributeEvent(instance, FrameLayout.ATTRIBUTE_SOURCE_ID, values[2], true);
+        service.getEventManager().send(e);                    
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/FrameRequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/FrameRequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/LinkRequestProcessorAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/LinkRequestProcessorAspect.java?view=auto&rev=510953
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/LinkRequestProcessorAspect.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/LinkRequestProcessorAspect.java Fri Feb 23 06:26:25 2007
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.services.aspects.impl;
+
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.event.Event;
+import org.apache.cocoon.portal.event.aspect.EventAspectContext;
+import org.apache.cocoon.portal.event.layout.LayoutInstanceChangeAttributeEvent;
+import org.apache.cocoon.portal.om.Layout;
+import org.apache.cocoon.portal.om.LayoutException;
+import org.apache.cocoon.portal.om.LayoutFeatures;
+import org.apache.cocoon.portal.om.LayoutInstance;
+import org.apache.cocoon.portal.om.LinkLayout;
+
+/**
+ *
+ * @version $Id$
+ */
+public class LinkRequestProcessorAspect extends AbstractContentRequestProcessorAspect {
+
+    /**
+     * @see org.apache.cocoon.portal.event.aspect.impl.AbstractContentEventAspect#getRequestParameterName(org.apache.cocoon.portal.event.aspect.EventAspectContext)
+     */
+    protected String getRequestParameterName(EventAspectContext context) {
+        return context.getAspectProperties().getProperty("parameter-name", "link");
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.event.aspect.impl.AbstractContentEventAspect#getRequiredValueCount()
+     */
+    protected int getRequiredValueCount() {
+        return 2;
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.event.aspect.impl.AbstractContentEventAspect#publish(PortalService, org.apache.cocoon.portal.om.Layout, java.lang.String[])
+     */
+    protected void publish(PortalService service,
+                           Layout        layout,
+                           String[]      values)
+    throws LayoutException {
+        LayoutFeatures.checkLayoutClass(layout, LinkLayout.class, true);
+        final LayoutInstance instance = LayoutFeatures.getLayoutInstance(service, layout, true);
+        final Event e = new LayoutInstanceChangeAttributeEvent(instance, LinkLayout.ATTRIBUTE_LAYOUT_ID, values[2], true);
+        service.getEventManager().send(e);                    
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/LinkRequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/LinkRequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/NoClientCachingRequestProcessorAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/NoClientCachingRequestProcessorAspect.java?view=auto&rev=510953
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/NoClientCachingRequestProcessorAspect.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/NoClientCachingRequestProcessorAspect.java Fri Feb 23 06:26:25 2007
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.services.aspects.impl;
+
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Response;
+import org.apache.cocoon.portal.event.aspect.EventAspect;
+import org.apache.cocoon.portal.event.aspect.EventAspectContext;
+import org.apache.cocoon.portal.util.AbstractBean;
+
+/**
+ * This aspect implementation sets some headers on the response that tell
+ * clients/proxies to not cache. This "disables" the back button on the
+ * client.
+ *
+ * @version $Id$
+ */
+public class NoClientCachingRequestProcessorAspect
+	extends AbstractBean
+	implements EventAspect {
+
+	/**
+	 * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext)
+	 */
+	public void process(EventAspectContext context) {
+        final Response response = ObjectModelHelper.getResponse( context.getPortalService().getProcessInfoProvider().getObjectModel() );
+        response.setHeader("Cache-Control", "no-cache");
+        response.addHeader("Cache-Control", "no-store");
+        response.setHeader("Pragma", "no-cache");
+        response.setHeader("Expires", "Thu, 01 Jan 2000 00:00:00 GMT");
+
+        context.invokeNext();
+	}
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/NoClientCachingRequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/NoClientCachingRequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/RequestParameterRequestProcessorAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/RequestParameterRequestProcessorAspect.java?view=auto&rev=510953
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/RequestParameterRequestProcessorAspect.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/RequestParameterRequestProcessorAspect.java Fri Feb 23 06:26:25 2007
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.services.aspects.impl;
+
+import java.util.StringTokenizer;
+
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.Request;
+import org.apache.cocoon.portal.event.Event;
+import org.apache.cocoon.portal.event.EventConverter;
+import org.apache.cocoon.portal.event.EventManager;
+import org.apache.cocoon.portal.event.aspect.EventAspect;
+import org.apache.cocoon.portal.event.aspect.EventAspectContext;
+import org.apache.cocoon.portal.util.AbstractBean;
+
+/**
+ *
+ * @version $Id$
+ */
+public class RequestParameterRequestProcessorAspect
+	extends AbstractBean
+	implements EventAspect {
+
+    protected void process(EventAspectContext context,
+                           Request            request,
+                           String             parameterName) {
+        final EventManager publisher = context.getPortalService().getEventManager();
+        final EventConverter converter = context.getPortalService().getEventConverter();
+
+        final String[] values = request.getParameterValues( parameterName );
+        if ( values != null ) {
+            for(int i=0; i<values.length; i++) {
+                final String current = values[i];
+                final Event e = converter.decode(current);
+                if ( null != e) {
+                    publisher.send(e);
+                }
+            }
+        }
+    }
+
+	/**
+	 * @see org.apache.cocoon.portal.event.aspect.EventAspect#process(org.apache.cocoon.portal.event.aspect.EventAspectContext)
+	 */
+	public void process(EventAspectContext context) {
+        final String defaultRequestParameterName = context.getPortalService().getLinkService().getEventRequestParameterName();
+        final Request request = ObjectModelHelper.getRequest(context.getPortalService().getProcessInfoProvider().getObjectModel());
+        final String requestParameterNames = context.getAspectProperties().getProperty("parameter-name", defaultRequestParameterName);
+        boolean processedDefault = false;
+
+        StringTokenizer tokenizer = new StringTokenizer(requestParameterNames, ", ");
+        while ( tokenizer.hasMoreTokens() ) {
+            final String currentName = tokenizer.nextToken();
+            this.process(context, request, currentName);
+            if ( defaultRequestParameterName.equals(currentName) ) {
+                processedDefault = true;
+            }
+        }
+        if ( !processedDefault ) {
+            this.process( context, request, defaultRequestParameterName );
+        }
+        context.invokeNext();
+	}
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/RequestParameterRequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/RequestParameterRequestProcessorAspect.java
------------------------------------------------------------------------------
    svn:keywords = Id

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/RequestProcessorAspectContextImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/RequestProcessorAspectContextImpl.java?view=auto&rev=510953
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/RequestProcessorAspectContextImpl.java (added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/RequestProcessorAspectContextImpl.java Fri Feb 23 06:26:25 2007
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.services.aspects.impl.support;
+
+import org.apache.cocoon.portal.PortalException;
+import org.apache.cocoon.portal.PortalService;
+import org.apache.cocoon.portal.services.aspects.RequestProcessorAspect;
+import org.apache.cocoon.portal.services.aspects.RequestProcessorAspectContext;
+import org.apache.cocoon.portal.services.aspects.support.AspectChain;
+import org.apache.cocoon.portal.services.aspects.support.BasicAspectContextImpl;
+
+/**
+ * Implementation of the {@link RequestProcessorAspectContext}.
+ *
+ * @version $Id$
+ */
+public final class RequestProcessorAspectContextImpl
+    extends BasicAspectContextImpl
+    implements RequestProcessorAspectContext {
+
+    public RequestProcessorAspectContextImpl(PortalService service,
+                                             AspectChain    chain) {
+        super(service, chain);
+    }
+
+	/**
+	 * @see org.apache.cocoon.portal.services.aspects.RequestProcessorAspectContext#invokeNext()
+	 */
+	public void invokeNext()
+    throws PortalException {
+        final RequestProcessorAspect aspect = (RequestProcessorAspect)this.getNext();
+        if ( aspect != null ) {
+            aspect.process(this);
+        }
+    }
+}

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/RequestProcessorAspectContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/aspects/impl/support/RequestProcessorAspectContextImpl.java
------------------------------------------------------------------------------
    svn:keywords = Id