cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/webdav/samples/davmap sitemap.xmap
Date Thu, 30 Oct 2003 14:38:47 GMT
unico       2003/10/30 06:38:47

  Modified:    src/blocks/webdav/samples/davmap sitemap.xmap
  Log:
  refactorings: simplify PROPFIND, implement PUT using pipeline "T-ing",
  add directory browsing, add MKCOL method, add DELETE method
  
  Revision  Changes    Path
  1.5       +199 -129  cocoon-2.1/src/blocks/webdav/samples/davmap/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/webdav/samples/davmap/sitemap.xmap,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- sitemap.xmap	20 Aug 2003 18:57:21 -0000	1.4
  +++ sitemap.xmap	30 Oct 2003 14:38:46 -0000	1.5
  @@ -1,134 +1,204 @@
   <?xml version="1.0"?>
   <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
   
  -<map:components>
  -  <map:generators default="file">
  -    <map:generator name="traverse" src="org.apache.cocoon.generation.TraversableGenerator"/>
  -  </map:generators>
  -  <map:selectors default="browser">
  -    <map:selector logger="sitemap.selector.header" name="depth" src="org.apache.cocoon.selection.HeaderSelector">
  -      <header-name>Depth</header-name>
  -    </map:selector>
  -  </map:selectors>
  -</map:components>
  -<map:flow language="javascript">
  -  <map:script src="webdav.js"/>
  -</map:flow>
  -
  -<map:pipelines>
  -  <map:component-configurations>
  -    <global-variables>
  -      <staging></staging>
  -      <!--staging>webdav://localhost/webdav/davmap/</staging-->
  -    </global-variables>
  -  </map:component-configurations>
  -
  -  <map:pipeline>
  -    <map:match pattern="repo">
  -      <map:call function="selectMethod">
  -        <map:parameter name="page" value="repo"/>
  -      </map:call>
  -    </map:match>
  -    <map:match pattern="repo/">
  -      <map:call function="selectMethod">
  -        <map:parameter name="page" value="repo/"/>
  -      </map:call>
  -    </map:match>
  -    <map:match pattern="repo/**">
  -      <map:call function="selectMethod">
  -        <map:parameter name="page" value="repo/{1}"/>
  -      </map:call>
  -    </map:match>
  -
  -    <map:match pattern="GET/repo/">
  -      <map:generate type="traverse" src="{global:staging}repo/">
  -        <map:parameter name="depth" value="1"/>
  -      </map:generate>
  -      <map:serialize type="xml"/>
  -    </map:match>
  -    <map:match pattern="GET/**">
  -      <map:generate src="{global:staging}{1}"/>
  -      <map:serialize type="xml"/>
  -    </map:match>
  -
  -    <map:match pattern="PROPFIND/**/*.*">
  -      <map:generate type="traverse" src="{global:staging}{1}/"/>
  -      <map:transform src="{global:staging}styles/file2propfind0.xsl">
  -        <map:parameter name="requestURI" value="{request:requestURI}"/>
  -        <map:parameter name="directory" value="{1}"/>
  -        <map:parameter name="file" value="{2}.{3}"/>
  -      </map:transform>
  -      <map:serialize type="xml" status-code="207"/>
  -    </map:match>
  -    <map:match pattern="PROPFIND/**">
  -      <map:generate type="traverse" src="{global:staging}{1}/"/>
  -      <map:select type="depth">
  -        <map:when test="0">
  -          <map:transform src="{global:staging}styles/dir2propfind0.xsl">
  -            <map:parameter name="requestURI" value="{request:requestURI}"/>
  -          </map:transform>
  -        </map:when>
  -        <map:otherwise>
  -          <map:transform src="{global:staging}styles/dir2propfind1.xsl">
  -            <map:parameter name="requestURI" value="{request:requestURI}"/>
  -          </map:transform>
  -        </map:otherwise>
  -      </map:select>
  -      <map:serialize type="xml" status-code="207"/>
  -    </map:match>
  -
  -    <map:match pattern="PUT/**/*.*">
  -      <map:generate type="stream">
  -        <map:parameter name="defaultContentType" value="text/xml"/>
  -      </map:generate>
  -      <map:transform src="styles/stream2write.xsl">
  -        <map:parameter name="file" value="{global:staging}{1}/{2}.{3}"/>
  -      </map:transform>
  -      <map:transform type="write-source"/>
  -      <map:serialize/>
  -    </map:match>
  -
  -    <map:match pattern="OPTIONS/**">
  -      <map:act type="set-header">
  -        <map:parameter name="DAV" value="DAV:1"/>
  -        <map:parameter name="Allow" value="OPTIONS, GET, HEAD, POST, DELETE,TRACE, PROPFIND,
PROPPATCH, COPY, MOVE"/>
  -      </map:act>
  -      <map:generate src="dummy.xml"/>
  -      <map:serialize type="xml"/>
  -    </map:match>
  -    <map:match pattern="DELETE/**">
  -      <map:generate src="dummy.xml"/>
  -      <map:serialize type="xml"/>
  -    </map:match>
  -    <map:match pattern="COPY/**">
  -      <map:generate src="dummy.xml"/>
  -      <map:serialize type="xml"/>
  -    </map:match>
  -    <map:match pattern="MOVE/**">
  -      <map:generate src="dummy.xml"/>
  -      <map:serialize type="xml"/>
  -    </map:match>
  -    <map:match pattern="PROPPATCH/**">
  -      <map:generate src="dummy.xml"/>
  -      <map:serialize type="xml"/>
  -    </map:match>
  -    <map:match pattern="LOCK/**">
  -      <map:generate src="dummy.xml"/>
  -      <map:serialize type="xml"/>
  -    </map:match>
  -    <map:match pattern="HEAD/**">
  -      <map:generate src="dummy.xml"/>
  -      <map:serialize type="xml"/>
  -    </map:match>
  -    <map:match pattern="TRACE/**">
  -      <map:generate src="dummy.xml"/>
  -      <map:serialize type="xml"/>
  -    </map:match>
  -    <map:match pattern="POST/**">
  -      <map:generate src="dummy.xml"/>
  -      <map:serialize type="xml"/>
  -    </map:match>
  -  </map:pipeline>
  -</map:pipelines>
  +<!-- =========================== Components ================================ -->
  +
  +  <map:components>
  +    <map:generators default="file">
  +      <map:generator 
  +        name="traverse" 
  +        src="org.apache.cocoon.generation.TraversableGenerator" 
  +        logger="generator.traverse" 
  +        label="content" 
  +        pool-min="2" pool-grow="2" pool-max="16"
  +      />
  +      <map:generator name="jx" 
  +        src="org.apache.cocoon.generation.JXTemplateGenerator" 
  +        logger="sitemap.generator.jx" 
  +        label="content" 
  +        pool-min="2" pool-grow="2" pool-max="16" 
  +      />
  +    </map:generators>
  +
  +    <map:pipes default="caching">
  +      <map:pipe 
  +        name="event-caching" 
  +        src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline"
  +      >
  +        <!-- parameter name="outputBufferSize" value="8192"/ -->
  +        <parameter name="cache-role" value="org.apache.cocoon.caching.Cache/EventAware"/>
  +      </map:pipe>
  +    </map:pipes>
  +
  +  </map:components>
  +
  +<!-- ========================== Flowscript ================================= -->
  +
  +  <map:flow language="javascript">
  +    <map:script src="webdav.js"/>
  +  </map:flow>
  +
  +<!-- =========================== Views ===================================== -->
  +
  +  <map:views>    
  +    <map:view name="content" from-label="content">
  +      <map:serialize type="xml" />
  +    </map:view>
  +  </map:views>
  +
  +  <map:pipelines>
  +    
  +    <map:component-configurations>
  +      <global-variables>
  +        <staging>./repo/</staging>
  +      </global-variables>
  +    </map:component-configurations>
  +    
  +<!-- ========================= Private Resources =========================== -->
  +
  +    <map:pipeline type="noncaching" internal-only="true">
  +      
  +      <!-- Read the request for binaries PUT -->
  +      <!--
  +      <map:match pattern="request/read">
  +        <map:read type="request" />
  +      </map:match>
  +      -->
  +      
  +      <map:match pattern="request/generate">
  +        <map:generate type="stream" />
  +        <map:serialize type="xml" />
  +      </map:match>
  +      
  +      <!--+ 
  +          | If you need to check or change the XML that is being PUT
  +          | you can do that here. This is the pipeline that will
  +          | generate the input for the PUT method
  +          + -->
  +      <map:match pattern="request/PUT">
  +        <map:generate type="stream" />
  +        <map:serialize type="xml" />
  +      </map:match>
  +      
  +      <map:match pattern="status/*">
  +        <map:generate type="jx" src="status.jx">
  +          <map:parameter name="status" value="{1}" />
  +        </map:generate>
  +        <map:serialize type="xml" status-code="{1}" />
  +      </map:match>
  +      
  +    </map:pipeline>
  +    
  +<!-- ========================= Public Resources =========================== -->
  +
  +    <map:pipeline type="caching">
  +      
  +      <map:match pattern="repo">
  +        <map:call function="selectMethod">
  +          <map:parameter name="page" value=""/>
  +        </map:call>
  +      </map:match>
  +      <map:match pattern="repo/**">
  +        <map:call function="selectMethod">
  +          <map:parameter name="page" value="{1}"/>
  +        </map:call>
  +      </map:match>
  +      
  +      <map:match pattern="GET/**">
  +        <map:match pattern="GET/**.*">
  +          <map:generate src="{global:staging}{1}.{2}"/>
  +          <map:serialize type="xml"/>
  +        </map:match>
  +        <map:generate type="traverse" src="{global:staging}{1}">
  +          <map:parameter name="depth" value="1"/>
  +        </map:generate>
  +        <map:transform src="styles/collection2html.xsl">
  +          <map:parameter name="requestURI" value="{request:requestURI}" />
  +        </map:transform>
  +        <map:serialize type="html"/>
  +      </map:match>
  +      
  +      <map:match pattern="PROPFIND/**">
  +        <map:generate type="traverse" src="{global:staging}{1}">
  +          <map:parameter name="depth" value="{request-header:depth}" />
  +        </map:generate>
  +        <map:transform src="styles/collection2propfind.xsl">
  +          <map:parameter name="requestURI" value="{request:requestURI}" />
  +        </map:transform>
  +        <map:serialize type="xml" status-code="207" />
  +      </map:match>
  +      
  +      <map:match pattern="OPTIONS/**">
  +        <map:act type="set-header">
  +          <map:parameter name="DAV" value="DAV:1"/>
  +          <map:parameter name="Allow" 
  +            value="OPTIONS, GET, HEAD, POST, DELETE,TRACE, PROPFIND, PROPPATCH, COPY, MOVE"/>
  +        </map:act>
  +        <map:generate src="dummy.xml"/>
  +        <map:serialize type="xml"/>
  +      </map:match>
  +      
  +      <map:match pattern="HEAD/**">
  +        <map:generate src="dummy.xml"/>
  +        <map:serialize type="xml"/>
  +      </map:match>
  +      <map:match pattern="TRACE/**">
  +        <map:generate src="dummy.xml"/>
  +        <map:serialize type="xml"/>
  +      </map:match>
  +      <map:match pattern="POST/**">
  +        <map:generate src="dummy.xml"/>
  +        <map:serialize type="xml"/>
  +      </map:match>
  +      
  +    </map:pipeline>
  +    
  +    <map:pipeline type="noncaching">
  +    
  +      <map:match pattern="PUT/**.*">
  +        <map:call function="put">
  +          <map:parameter name="src" value="cocoon:/request/PUT" />
  +          <map:parameter name="dest" value="{global:staging}{1}.{2}" />
  +        </map:call>
  +      </map:match>
  +      
  +      <map:match pattern="MKCOL/**">
  +        <map:match pattern="MKCOL/**.*">
  +          <map:call function="sendStatus">
  +            <map:parameter name="status" value="409" />
  +            <map:parameter name="message" value="Not valid collection name." />
  +          </map:call>
  +        </map:match>
  +        <map:call function="mkcol">
  +          <map:parameter name="location" value="{global:staging}{1}" />
  +        </map:call>
  +      </map:match>
  +      
  +      <map:match pattern="DELETE/**">
  +        <map:call function="remove">
  +          <map:parameter name="location" value="{global:staging}{1}.{2}" />
  +        </map:call>
  +      </map:match>
  +      
  +      <map:match pattern="COPY/**">
  +        <map:generate src="dummy.xml"/>
  +        <map:serialize type="xml"/>
  +      </map:match>
  +      <map:match pattern="MOVE/**">
  +        <map:generate src="dummy.xml"/>
  +        <map:serialize type="xml"/>
  +      </map:match>
  +      <map:match pattern="PROPPATCH/**">
  +        <map:generate src="dummy.xml"/>
  +        <map:serialize type="xml"/>
  +      </map:match>
  +      <map:match pattern="LOCK/**">
  +        <map:generate src="dummy.xml"/>
  +        <map:serialize type="xml"/>
  +      </map:match>
  +      
  +    </map:pipeline>
  +
  +  </map:pipelines>
   
   </map:sitemap>
  
  
  

Mime
View raw message