cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gcas...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/webdav/samples/davmap webdav.js sitemap.xmap
Date Wed, 20 Aug 2003 18:57:22 GMT
gcasper     2003/08/20 11:57:22

  Modified:    src/blocks/webdav/samples/davmap sitemap.xmap
  Added:       src/blocks/webdav/samples/davmap webdav.js
  Log:
  Moved "request routing" to flowscript
  This further simplifies the sitemap (the flowscript is barely 4 lines) and
  hopefully flattens the way to using request factories
  
  Revision  Changes    Path
  1.4       +100 -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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- sitemap.xmap	10 Aug 2003 07:52:42 -0000	1.3
  +++ sitemap.xmap	20 Aug 2003 18:57:21 -0000	1.4
  @@ -6,132 +6,14 @@
       <map:generator name="traverse" src="org.apache.cocoon.generation.TraversableGenerator"/>
     </map:generators>
     <map:selectors default="browser">
  -    <map:selector logger="sitemap.selector.method" name="request-method" src="org.apache.cocoon.selection.RequestMethodSelector"/>
       <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:resources>
  -
  -<map:resource name="GET">
  -  <map:match pattern="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="**">
  -    <map:generate src="{global:staging}{1}"/>
  -    <map:serialize type="xml"/>
  -  </map:match>
  -</map:resource>
  -
  -<map:resource name="OPTIONS">
  -  <map:match pattern="**">
  -    <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:resource>
  -
  -<map:resource name="PROPFIND">
  -  <map:match pattern="**/*.*">
  -    <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="**/">
  -    <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="**">
  -    <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:resource>
  -
  -<map:resource name="PUT">
  -  <map:match pattern="**/*.*">
  -    <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:resource>
  -
  -<map:resource name="DELETE">
  -  <map:generate src="dummy.xml"/>
  -  <map:serialize type="xml"/>
  -</map:resource>
  -
  -<map:resource name="COPY">
  -  <map:generate src="dummy.xml"/>
  -  <map:serialize type="xml"/>
  -</map:resource>
  -
  -<map:resource name="MOVE">
  -  <map:generate src="dummy.xml"/>
  -  <map:serialize type="xml"/>
  -</map:resource>
  -
  -<map:resource name="PROPPATCH">
  -  <map:generate src="dummy.xml"/>
  -  <map:serialize type="xml"/>
  -</map:resource>
  -
  -<map:resource name="LOCK">
  -  <map:generate src="dummy.xml"/>
  -  <map:serialize type="xml"/>
  -</map:resource>
  -
  -<map:resource name="HEAD">
  -  <map:generate src="dummy.xml"/>
  -  <map:serialize type="xml"/>
  -</map:resource>
  -
  -<map:resource name="TRACE">
  -  <map:generate src="dummy.xml"/>
  -  <map:serialize type="xml"/>
  -</map:resource>
  -
  -</map:resources>
  +<map:flow language="javascript">
  +  <map:script src="webdav.js"/>
  +</map:flow>
   
   <map:pipelines>
     <map:component-configurations>
  @@ -143,19 +25,108 @@
   
     <map:pipeline>
       <map:match pattern="repo">
  -      <map:call resource="{request:method}"/>
  +      <map:call function="selectMethod">
  +        <map:parameter name="page" value="repo"/>
  +      </map:call>
       </map:match>
       <map:match pattern="repo/">
  -      <map:call resource="{request:method}"/>
  +      <map:call function="selectMethod">
  +        <map:parameter name="page" value="repo/"/>
  +      </map:call>
       </map:match>
  -    <map:match pattern="repo/**/*.*">
  -      <map:call resource="{request:method}"/>
  +    <map:match pattern="repo/**">
  +      <map:call function="selectMethod">
  +        <map:parameter name="page" value="repo/{1}"/>
  +      </map:call>
       </map:match>
  -    <map:match pattern="repo/**/">
  -      <map:call resource="{request:method}"/>
  +
  +    <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="repo/**">
  -      <map:call resource="{request:method}"/>
  +    <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>
  
  
  
  1.1                  cocoon-2.1/src/blocks/webdav/samples/davmap/webdav.js
  
  Index: webdav.js
  ===================================================================
  function selectMethod() {
      var page = cocoon.parameters["page"];
      var method = cocoon.request.getMethod();
      cocoon.sendPage(method+"/"+page, {});
  }
  
  
  

Mime
View raw message