cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r510946 - in /cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal: event/aspect/impl/RequestParameterEventAspect.java services/LinkService.java services/impl/links/DefaultLinkService.java
Date Fri, 23 Feb 2007 13:43:57 GMT
Author: cziegeler
Date: Fri Feb 23 05:43:56 2007
New Revision: 510946

URL: http://svn.apache.org/viewvc?view=rev&rev=510946
Log:
Use configured request parameter name for decoding events

Modified:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LinkService.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/impl/links/DefaultLinkService.java

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java?view=diff&rev=510946&r1=510945&r2=510946
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/event/aspect/impl/RequestParameterEventAspect.java
Fri Feb 23 05:43:56 2007
@@ -21,10 +21,10 @@
 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.services.LinkService;
 import org.apache.cocoon.portal.util.AbstractBean;
 
 /**
@@ -38,12 +38,14 @@
     protected void process(EventAspectContext context,
                            Request            request,
                            String             parameterName) {
-        String[] values = request.getParameterValues( 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 = context.getPortalService().getEventConverter().decode(current);
+                final Event e = converter.decode(current);
                 if ( null != e) {
                     publisher.send(e);
                 }
@@ -55,20 +57,21 @@
 	 * @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",
LinkService.DEFAULT_REQUEST_EVENT_PARAMETER_NAME);
+        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 ( LinkService.DEFAULT_REQUEST_EVENT_PARAMETER_NAME.equals(currentName) ) {
+            if ( defaultRequestParameterName.equals(currentName) ) {
                 processedDefault = true;
             }
         }
         if ( !processedDefault ) {
-            this.process( context, request, LinkService.DEFAULT_REQUEST_EVENT_PARAMETER_NAME
);
+            this.process( context, request, defaultRequestParameterName );
         }
         context.invokeNext();
 	}

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LinkService.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LinkService.java?view=diff&rev=510946&r1=510945&r2=510946
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LinkService.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/LinkService.java
Fri Feb 23 05:43:56 2007
@@ -30,14 +30,14 @@
 public interface LinkService {
 
     /** The request parameter name used for adding event information to the url. */
-    String DEFAULT_REQUEST_EVENT_PARAMETER_NAME = "cocoon-portal-event";
+    String DEFAULT_EVENT_REQUEST_PARAMETER_NAME = "cocoon-portal-event";
 
     /** These parameters are used by default for adding portal specific information to a
url. */
     List DEFAULT_INTERNAL_PARAMETERS = Collections.singletonList("cocoon-*");
 
     /**
      * This object holds a 'complete' request parameter (or several) which means it
-     * contains a string like {name}={value}. The value should already be url encoded! 
+     * contains a string like {name}={value}. The value should already be url encoded!
      */
     static class ParameterDescription {
 
@@ -131,7 +131,7 @@
     /**
      * @param url The url to encode.
      * @return The enocoded URL.
-     * @see javax.servlet.http.HttpServletResponse#encodeURL(java.lang.String) 
+     * @see javax.servlet.http.HttpServletResponse#encodeURL(java.lang.String)
      */
     String encodeURL(String url);
 
@@ -139,4 +139,9 @@
      * Test if the parameter is an internal one.
      */
     boolean isInternalParameterName(String name);
+
+    /**
+     * Get the name of the request parameter used to encode events.
+     */
+    String getEventRequestParameterName();
 }

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/impl/links/DefaultLinkService.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/impl/links/DefaultLinkService.java?view=diff&rev=510946&r1=510945&r2=510946
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/impl/links/DefaultLinkService.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/services/impl/links/DefaultLinkService.java
Fri Feb 23 05:43:56 2007
@@ -40,7 +40,7 @@
  *
  * @version $Id$
  */
-public class DefaultLinkService 
+public class DefaultLinkService
     extends AbstractBean
     implements LinkService {
 
@@ -54,7 +54,7 @@
     protected List internalParametersMatchers = new ArrayList();
 
     /** The name of the request parameter for events. */
-    protected String requestParameterName = LinkService.DEFAULT_REQUEST_EVENT_PARAMETER_NAME;
+    protected String requestParameterName = LinkService.DEFAULT_EVENT_REQUEST_PARAMETER_NAME;
 
     /**
      * Construct a new link service.
@@ -98,7 +98,7 @@
                 } else {
                     this.internalParametersMatchers.add(new ConstantParameterMatcher(parameter));
                 }
-            }            
+            }
         }
     }
 
@@ -205,7 +205,7 @@
             final Iterator iter = info.comparableEvents.iterator();
             while (iter.hasNext()) {
                 final ComparableEvent current = (ComparableEvent)iter.next();
-    
+
                 final Iterator eventIterator = events.iterator();
                 boolean found = false;
                 while (!found && eventIterator.hasNext()) {
@@ -351,5 +351,12 @@
         }
 
         return buffer.toString();
+    }
+
+    /**
+     * @see org.apache.cocoon.portal.services.LinkService#getEventRequestParameterName()
+     */
+    public String getEventRequestParameterName() {
+        return this.requestParameterName;
     }
 }



Mime
View raw message