Author: sylvain
Date: Wed Feb  2 00:54:29 2005
New Revision: 149499

URL: http://svn.apache.org/viewcvs?view=rev&rev=149499
Log:
more fixing of pass-through mounts and cocoon: URLs

Added:
    cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/
    
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/hellosub.xml
   (with props)
    
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/sitemap.xmap
   (with props)
Modified:
    
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/CocoonComponentManager.java
    
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
    
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
    
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
    
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/explain-test.xml
    
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sitemap.xmap

Modified: 
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/CocoonComponentManager.java
URL: 
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/CocoonComponentManager.java?view=diff&r1=149498&r2=149499
==============================================================================
--- 
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/CocoonComponentManager.java
 (original)
+++ 
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/CocoonComponentManager.java
 Wed Feb  2 00:54:29 2005
@@ -131,7 +131,8 @@
      * It's the counterpart to [EMAIL PROTECTED] 
#enterEnvironment(Environment, ComponentManager, Processor)}.
      */
     public static void leaveEnvironment() {
-        leaveEnvironment(false);
+        // Calling with true will avoid any change on the active processor
+        leaveEnvironment(true);
     }
 
     /**
@@ -160,7 +161,7 @@
             
env.removeAttribute(GlobalRequestLifecycleComponent.class.getName());
         } else {
             if (!success) {
-                // Restore the current environment as being the active one
+                // Restore the current processor as being the active one
                 getCurrentEnvironment().setAttribute(PROCESSOR_ATTR, 
getCurrentProcessor());
             }
         }
@@ -263,8 +264,8 @@
     /**
      * Return the processor that has actually processed the request
      */
-    public static Processor getActiveProcessor() {
-        return (Processor) 
getCurrentEnvironment().getAttribute(PROCESSOR_ATTR);
+    public static Processor getActiveProcessor(Environment env) {
+        return (Processor) env.getAttribute(PROCESSOR_ATTR);
     }
 
     /**
@@ -771,6 +772,6 @@
         } else {
             return null;
         }
-    }
+    }  
 }
 

Modified: 
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
URL: 
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java?view=diff&r1=149498&r2=149499
==============================================================================
--- 
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
 (original)
+++ 
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/SitemapSource.java
 Wed Feb  2 00:54:29 2005
@@ -140,12 +140,12 @@
         String prefix;
         if (uri.startsWith("//", position)) {
             position += 2;
-            this.processor = 
CocoonComponentManager.getActiveProcessor().getRootProcessor();
+            this.processor = 
CocoonComponentManager.getActiveProcessor(env).getRootProcessor();
             prefix = ""; // start at the root
         } else if (uri.startsWith("/", position)) {
             position ++;
             prefix = null;
-            this.processor = CocoonComponentManager.getActiveProcessor();
+            this.processor = CocoonComponentManager.getActiveProcessor(env);
         } else {
             throw new MalformedURLException("Malformed cocoon URI: " + uri);
         }
@@ -330,7 +330,7 @@
         try {
             this.processKey = 
CocoonComponentManager.startProcessing(this.environment);
             this.processingPipeline = 
this.processor.buildPipeline(this.environment);
-            this.pipelineProcessor = 
CocoonComponentManager.getActiveProcessor();
+            this.pipelineProcessor = 
CocoonComponentManager.getActiveProcessor(this.environment);
 
             String redirectURL = this.environment.getRedirectURL();
             if (redirectURL == null) {

Modified: 
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
URL: 
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java?view=diff&r1=149498&r2=149499
==============================================================================
--- 
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
 (original)
+++ 
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/ConcreteTreeProcessor.java
 Wed Feb  2 00:54:29 2005
@@ -329,6 +329,10 @@
         this.rootNode = null;
        }
     
+    public String toString() {
+        return "ConcreteTreeProcessor - " + wrappingProcessor.source.getURI();
+    }
+    
     private class TreeProcessorRedirector extends ForwardRedirector {
         
         private InvokeContext context;

Modified: 
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
URL: 
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java?view=diff&r1=149498&r2=149499
==============================================================================
--- 
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
 (original)
+++ 
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/TreeProcessor.java
 Wed Feb  2 00:54:29 2005
@@ -328,7 +328,7 @@
 
             
newProcessor.setProcessorData(builder.getSitemapComponentManager(), root, 
builder.getDisposableNodes());
         } finally {
-            CocoonComponentManager.leaveEnvironment(false);
+            CocoonComponentManager.leaveEnvironment();
             this.builderSelector.release(builder);
         }
 
@@ -377,4 +377,8 @@
             this.manager = null;
            }
        }
+    
+    public String toString() {
+        return "TreeProcessor - " + (source == null ? "[unknown location]" : 
source.getURI());
+    }
 }

Modified: 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/explain-test.xml
URL: 
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/explain-test.xml?view=diff&r1=149498&r2=149499
==============================================================================
--- 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/explain-test.xml
 (original)
+++ 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/explain-test.xml
 Wed Feb  2 00:54:29 2005
@@ -33,6 +33,7 @@
                 <li><link href="welcome1">One "cocoon:" URL</link></li>
                 <li><link href="welcome2">Two chained "cocoon:" 
URLs</link></li>
                 <li><link href="welcome3">Three chained "cocoon:" 
URLs</link></li>
+                  <li><link href="aggregate">Aggregation of the 
above</link></li>
             </ul>
         </para>
     </content>

Modified: 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sitemap.xmap
URL: 
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sitemap.xmap?view=diff&r1=149498&r2=149499
==============================================================================
--- 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sitemap.xmap 
(original)
+++ 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sitemap.xmap 
Wed Feb  2 00:54:29 2005
@@ -5,6 +5,10 @@
     <map:pipeline>
       <map:mount check-reload="true" uri-prefix=""
                  src="elsewhere/sitemap.xmap" pass-through="true"/>
+    
+         <map:match pattern="sub/**">
+               <map:mount src="sub/" uri-prefix="sub"/>
+         </map:match>
 
       <map:match pattern="welcome">
         <map:generate src="welcome.xml"/>
@@ -25,6 +29,26 @@
         <map:generate src="cocoon:/welcome2"/>
         <map:serialize/>
       </map:match>
+       
+         <map:match pattern="hellosub">
+               <!-- This pattern deliberately produces and error, as it is 
meant to trap
+                    wrong active processor in the handling of sub/sub1 -->
+               <map:serialize/>
+         </map:match>
+       
+         <map:match pattern="subsub1">
+               <map:generate src="cocoon:/sub/sub1"/>
+               <map:serialize/>
+         </map:match>
+       
+         <map:match pattern="aggregate">
+           <map:aggregate element="root">
+             <map:part src="cocoon:/welcome3"/>
+             <map:part src="cocoon:/welcome3"/>
+             <map:part src="cocoon:/subsub1"/>
+           </map:aggregate>
+               <map:serialize/>
+         </map:match>
 
     </map:pipeline>
   </map:pipelines>

Added: 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/hellosub.xml
URL: 
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/hellosub.xml?view=auto&rev=149499
==============================================================================
--- 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/hellosub.xml
 (added)
+++ 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/hellosub.xml
 Wed Feb  2 00:54:29 2005
@@ -0,0 +1 @@
+<h1>Hello Sub!</h1>

Propchange: 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/hellosub.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/hellosub.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/hellosub.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Added: 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/sitemap.xmap
URL: 
http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/sitemap.xmap?view=auto&rev=149499
==============================================================================
--- 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/sitemap.xmap
 (added)
+++ 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/sitemap.xmap
 Wed Feb  2 00:54:29 2005
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0";>
+  <map:pipelines>
+    <map:pipeline>
+         <map:match pattern="hellosub">
+               <map:generate src="hellosub.xml"/>
+               <map:serialize/>
+         </map:match>
+       
+         <map:match pattern="sub1">
+               <map:generate src="cocoon:/hellosub"/>
+               <map:serialize/>
+         </map:match>
+    </map:pipeline>
+  </map:pipelines>
+</map:sitemap>

Propchange: 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/sitemap.xmap
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/sitemap.xmap
------------------------------------------------------------------------------
    svn:executable = *

Propchange: 
cocoon/branches/BRANCH_2_1_X/src/webapp/samples/test/pass-through/sub/sitemap.xmap
------------------------------------------------------------------------------
    svn:keywords = Id


Reply via email to