cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dani...@apache.org
Subject svn commit: r473064 - in /cocoon/trunk/core: cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/ cocoon-core/src/main/java/org/apache/cocoon/core/deployment/ cocoon-core/src/main/resources/META-INF/cocoon/avalon/ cocoon-webapp/src/main/...
Date Thu, 09 Nov 2006 20:29:44 GMT
Author: danielf
Date: Thu Nov  9 12:29:43 2006
New Revision: 473064

URL: http://svn.apache.org/viewvc?view=rev&rev=473064
Log:
Now the block context source works and Cocoon can be used from an unpacked war.

* Fixed some bugs in the BlockContextSource and BlockContextSourceFactory.
* Unpack the blocks in the webapp temp dir instead of inside the webapp. This should make
it possible to run Cocoon from an unpacked war file.
* Add configurations for BlockContextSourceFactory and for XPathTraverableGenerator and TraversableGenerator
(used for traversing directories in the blockcontext).
* Use the blockcontext: protocol in the blocks part of the cocoon-webapp sitemap.xmap

Modified:
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSource.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSourceFactory.java
    cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java
    cocoon/trunk/core/cocoon-core/src/main/resources/META-INF/cocoon/avalon/cocoon-core-sitemapcomponents.xconf
    cocoon/trunk/core/cocoon-core/src/main/resources/META-INF/cocoon/avalon/cocoon-core-source-factories.xconf
    cocoon/trunk/core/cocoon-webapp/src/main/webapp/blocks/sitemap.xmap

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSource.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSource.java?view=diff&rev=473064&r1=473063&r2=473064
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSource.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSource.java
Thu Nov  9 12:29:43 2006
@@ -115,8 +115,7 @@
      * @see org.apache.excalibur.source.TraversableSource#getName()
      */
     public String getName() {
-        // FIXME: what name is the root directory supposed to have?
-        return null;
+        return ".";
     }
 
     /* (non-Javadoc)

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSourceFactory.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSourceFactory.java?view=diff&rev=473064&r1=473063&r2=473064
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSourceFactory.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/components/source/impl/BlockContextSourceFactory.java
Thu Nov  9 12:29:43 2006
@@ -63,7 +63,7 @@
         
         // Remove the protocol and the first '/'
         int pos = location.indexOf(":/");
-        String path = location.substring(pos+1);
+        String path = location.substring(pos+2);
         
         pos = path.indexOf('/');
         if (pos != -1) {

Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java?view=diff&rev=473064&r1=473063&r2=473064
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/deployment/DeploymentUtil.java
Thu Nov  9 12:29:43 2006
@@ -58,13 +58,8 @@
             return;
         }
         
-        final String pathToWebInf = servletContext.getRealPath("/WEB-INF");
-        if ( pathToWebInf == null ) {
-            // we run unexpanded
-            this.destinationDirectory = null;
-        } else {
-            this.destinationDirectory = pathToWebInf.substring(0, pathToWebInf.length() -
"/WEB-INF".length());
-        }
+        this.destinationDirectory =
+            ((File) servletContext.getAttribute("javax.servlet.context.tempdir")).getPath();
     }
 
     protected void deploy(JarFile jarFile, String prefix, String destination)

Modified: cocoon/trunk/core/cocoon-core/src/main/resources/META-INF/cocoon/avalon/cocoon-core-sitemapcomponents.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/resources/META-INF/cocoon/avalon/cocoon-core-sitemapcomponents.xconf?view=diff&rev=473064&r1=473063&r2=473064
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/resources/META-INF/cocoon/avalon/cocoon-core-sitemapcomponents.xconf
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/resources/META-INF/cocoon/avalon/cocoon-core-sitemapcomponents.xconf
Thu Nov  9 12:29:43 2006
@@ -56,6 +56,8 @@
    <map:generator label="content" logger="sitemap.generator.file" name="file" pool-max="32"
src="org.apache.cocoon.generation.FileGenerator"/>
    <map:generator label="content" logger="sitemap.generator.directory" name="directory"
pool-max="16" src="org.apache.cocoon.generation.DirectoryGenerator"/>
    <map:generator label="content" logger="sitemap.generator.xpathdirectory" name="xpathdirectory"
src="org.apache.cocoon.generation.XPathDirectoryGenerator"/>
+   <map:generator label="content" logger="sitemap.generator.traversable" name="traversable"
pool-max="16" src="org.apache.cocoon.generation.TraversableGenerator"/>
+   <map:generator label="content" logger="sitemap.generator.xpathtraversable" name="xpathtraversable"
src="org.apache.cocoon.generation.XPathTraversableGenerator"/>
    <map:generator label="content" logger="sitemap.generator.imagedirectory" name="imagedirectory"
src="org.apache.cocoon.generation.ImageDirectoryGenerator"/>
    <map:generator label="content" logger="sitemap.generator.request" name="request" pool-max="16"
src="org.apache.cocoon.generation.RequestGenerator"/>
    <map:generator label="content" logger="sitemap.generator.stream" name="stream" pool-max="16"
src="org.apache.cocoon.generation.StreamGenerator"/>

Modified: cocoon/trunk/core/cocoon-core/src/main/resources/META-INF/cocoon/avalon/cocoon-core-source-factories.xconf
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/resources/META-INF/cocoon/avalon/cocoon-core-source-factories.xconf?view=diff&rev=473064&r1=473063&r2=473064
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/resources/META-INF/cocoon/avalon/cocoon-core-source-factories.xconf
(original)
+++ cocoon/trunk/core/cocoon-core/src/main/resources/META-INF/cocoon/avalon/cocoon-core-source-factories.xconf
Thu Nov  9 12:29:43 2006
@@ -27,6 +27,7 @@
     <component-instance name="resource" class="org.apache.excalibur.source.impl.ResourceSourceFactory"/>
     <component-instance name="context" class="org.apache.cocoon.components.source.impl.ContextSourceFactory"/>
     <component-instance name="cocoon" class="org.apache.cocoon.components.source.impl.SitemapSourceFactory"/>
+    <component-instance name="blockcontext" class="org.apache.cocoon.components.source.impl.BlockContextSourceFactory"/>
     <!--component-instance name="block" class="org.apache.cocoon.components.source.impl.BlockSourceFactory"/-->
     
     <!--+

Modified: cocoon/trunk/core/cocoon-webapp/src/main/webapp/blocks/sitemap.xmap
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-webapp/src/main/webapp/blocks/sitemap.xmap?view=diff&rev=473064&r1=473063&r2=473064
==============================================================================
--- cocoon/trunk/core/cocoon-webapp/src/main/webapp/blocks/sitemap.xmap (original)
+++ cocoon/trunk/core/cocoon-webapp/src/main/webapp/blocks/sitemap.xmap Thu Nov  9 12:29:43
2006
@@ -19,12 +19,12 @@
   <map:pipelines>
     <map:pipeline>
       <map:match pattern="*/**">
-        <map:mount uri-prefix="{1}" src="{1}/"/>
+        <map:mount uri-prefix="{1}" src="blockcontext:/{1}/"/>
       </map:match>
     </map:pipeline>
     <map:pipeline>
       <map:match pattern="">
-        <map:generate type="xpathdirectory" src="./"> 
+        <map:generate type="xpathtraversable" src="blockcontext:/"> 
           <map:parameter name="xpath" value="/xsamples/group"/> 
           <map:parameter name="depth" value="2"/>
           <map:parameter name="xmlFiles" value="\.xsamples$"/> 



Mime
View raw message