cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r676499 - in /cocoon/whiteboard/corona/trunk: corona-sample-webapp/src/test/java/org/apache/cocoon/corona/it/ corona-sample/src/main/resources/COB-INF/ corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/ corona-sitemap/src/main/j...
Date Mon, 14 Jul 2008 07:50:28 GMT
Author: reinhard
Date: Mon Jul 14 00:50:28 2008
New Revision: 676499

URL: http://svn.apache.org/viewvc?rev=676499&view=rev
Log:
a <match> section can add pipeline components without a final Finisher component:

<map:match wildcard="advanced-matching-2">
  <map:generate src="sax-pipeline/simple.xml" />
  <map:match value="{jexl:corona.request.myparam}">
    <map:when equals="1">
      <map:transform src="sax-pipeline/simple.xslt">
        <map:parameter name="myParam" value="1" />
      </map:transform>
    </map:when>
    <map:otherwise>
      <map:transform src="sax-pipeline/simple.xslt">
        <map:parameter name="myParam" value="otherwise" />
      </map:transform>          
    </map:otherwise>
  </map:match>
  <map:serialize />
</map:match>  

Modified:
    cocoon/whiteboard/corona/trunk/corona-sample-webapp/src/test/java/org/apache/cocoon/corona/it/MatcherTest.java
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/overview.html
    cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java

Modified: cocoon/whiteboard/corona/trunk/corona-sample-webapp/src/test/java/org/apache/cocoon/corona/it/MatcherTest.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample-webapp/src/test/java/org/apache/cocoon/corona/it/MatcherTest.java?rev=676499&r1=676498&r2=676499&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample-webapp/src/test/java/org/apache/cocoon/corona/it/MatcherTest.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sample-webapp/src/test/java/org/apache/cocoon/corona/it/MatcherTest.java
Mon Jul 14 00:50:28 2008
@@ -54,4 +54,16 @@
         this.assertXPath("/html/body/p", "otherwise");
     }
 
+    public void testMatchUncompletePipeline() throws Exception {
+        this.loadXmlPage("advanced-matching-2?myparam=1");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/xml", this.response.getContentType());
+        this.assertXPath("/html/body/p", "1");
+
+        this.loadXmlPage("advanced-matching-2?myparam=2");
+        assertTrue(this.response.getStatusCode() == 200);
+        assertEquals("text/xml", this.response.getContentType());
+        this.assertXPath("/html/body/p", "otherwise");
+    }
+
 }

Modified: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/overview.html
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/overview.html?rev=676499&r1=676498&r2=676499&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/overview.html
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/overview.html
Mon Jul 14 00:50:28 2008
@@ -66,10 +66,12 @@
   <h2>Advanced Matching</h2>
   <p>(using a JEXL expression to set a test value)</p>
   <ul>
-    <li><a href="advanced-matching?myparam=11">Equals matcher (using an JEXL
expression to set a test value)</li>
-    <li><a href="advanced-matching?myparam=22">Regular expression matcher (using
an JEXL expression to set a test value)</li>
-    <li><a href="advanced-matching?myparam=55">Ends-with matcher (using an JEXL
expression to set a test value)</li>
-    <li><a href="advanced-matching">Reach the otherwise section</li>
+    <li><a href="advanced-matching?myparam=11">Equals matcher</a> (using
an JEXL expression to set a test value)</li>
+    <li><a href="advanced-matching?myparam=22">Regular expression</a> matcher
(using an JEXL expression to set a test value)</li>
+    <li><a href="advanced-matching?myparam=55">Ends-with matcher</a> (using
an JEXL expression to set a test value)</li>
+    <li><a href="advanced-matching">Otherwise</a> Reach the otherwise section</li>
+    <li><a href="advanced-matching-2?myparam=1">Uncomplete pipeline: when</a>
Adding a transformer</li>
+    <li><a href="advanced-matching-2?myparam=2">Uncomplete pipeline: otherwise</a>
Adding a transformer</li>
   </ul>
   <h2>Aggregation</h2>
   <ul>

Modified: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap?rev=676499&r1=676498&r2=676499&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap (original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/COB-INF/sitemap.xmap Mon
Jul 14 00:50:28 2008
@@ -209,6 +209,22 @@
           </map:otherwise>
         </map:match>
       </map:match>
+      <map:match wildcard="advanced-matching-2">
+        <map:generate src="sax-pipeline/simple.xml" />
+        <map:match value="{jexl:corona.request.myparam}">
+          <map:when equals="1">
+            <map:transform src="sax-pipeline/simple.xslt">
+              <map:parameter name="myParam" value="1" />
+            </map:transform>
+          </map:when>
+          <map:otherwise>
+            <map:transform src="sax-pipeline/simple.xslt">
+              <map:parameter name="myParam" value="otherwise" />
+            </map:transform>          
+          </map:otherwise>
+        </map:match>
+        <map:serialize />
+      </map:match>      
     </map:pipeline>    
 
     <!-- ~~~~~~~~~~~~~~~~ aggregation ~~~~~~~~~~~~~~~ -->

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java?rev=676499&r1=676498&r2=676499&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java
Mon Jul 14 00:50:28 2008
@@ -36,6 +36,8 @@
 
     Throwable getThrowable();
 
+    boolean hasCompletePipeline();
+
     void installAction(String type);
 
     void installComponent(String type, Map<String, ? extends Object> parameters);

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java?rev=676499&r1=676498&r2=676499&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
Mon Jul 14 00:50:28 2008
@@ -28,6 +28,7 @@
 
 import org.apache.cocoon.corona.pipeline.Pipeline;
 import org.apache.cocoon.corona.pipeline.action.Action;
+import org.apache.cocoon.corona.pipeline.component.Finisher;
 import org.apache.cocoon.corona.pipeline.component.PipelineComponent;
 import org.apache.cocoon.corona.sitemap.expression.LanguageInterpreter;
 import org.apache.cocoon.corona.sitemap.objectmodel.ObjectModel;
@@ -47,6 +48,8 @@
 
     private ObjectModel objectModel;
 
+    private boolean hasFinisher;
+
     public InvocationImpl() {
     }
 
@@ -150,6 +153,15 @@
     /**
      * {@inheritDoc}
      * 
+     * @see org.apache.cocoon.corona.sitemap.Invocation#hasCompletePipeline()
+     */
+    public boolean hasCompletePipeline() {
+        return this.hasFinisher;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#installAction(java.lang.String)
      */
     public void installAction(String type) {
@@ -175,6 +187,10 @@
         Map<String, ? extends Object> resolvedParameters = this.resolveParameters(componentParameters);
         component.setConfiguration(resolvedParameters);
         this.pipeline.addComponent(component);
+
+        if (component instanceof Finisher) {
+            this.hasFinisher = true;
+        }
     }
 
     /**

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java?rev=676499&r1=676498&r2=676499&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/MatchNode.java
Mon Jul 14 00:50:28 2008
@@ -94,7 +94,11 @@
             InvocationResult invocationResult = super.invoke(invocation);
 
             if (invocationResult.isProcessed()) {
-                return InvocationResult.COMPLETED;
+                if (invocation.hasCompletePipeline()) {
+                    return InvocationResult.COMPLETED;
+                } else {
+                    return InvocationResult.PROCESSED;
+                }
             }
 
             return InvocationResult.NONE;



Mime
View raw message