You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by un...@apache.org on 2003/11/03 09:37:25 UTC
cvs commit: cocoon-2.1/src/blocks/webdav/samples/davmap sitemap.xmap webdav.js
unico 2003/11/03 00:37:25
Modified: src/blocks/webdav/samples/davmap sitemap.xmap webdav.js
Log:
move OPTIONS into flow; use repository source; parse Destination header to make COPY and MOVE work
follow rfc822 on dates according to spec; make PROPPATCH work
Revision Changes Path
1.10 +35 -33 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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- sitemap.xmap 31 Oct 2003 23:54:28 -0000 1.9
+++ sitemap.xmap 3 Nov 2003 08:37:25 -0000 1.10
@@ -21,7 +21,7 @@
/>
</map:generators>
- <map:transformers default="xslt">
+ <map:transformers default="xslt">
<map:transformer
name="spw"
src="org.apache.cocoon.transformation.SourcePropsWritingTransformer"
@@ -30,7 +30,8 @@
/>
</map:transformers>
- <!-- You'll need event caching if you want to PROPPATCH
+ <!-- If event caching is enabled you'll need to uncomment this in order
+ for PROPPATCH to work properly
<map:pipes default="caching">
<map:pipe name="event-caching"
src="org.apache.cocoon.components.pipeline.impl.CachingProcessingPipeline"
@@ -40,6 +41,15 @@
</map:pipes>
-->
+ <map:matchers default="wildcard">
+ <map:matcher
+ name="destination"
+ src="org.apache.cocoon.matching.WildcardHeaderMatcher"
+ >
+ <header-name>Destination</header-name>
+ </map:matcher>
+ </map:matchers>
+
</map:components>
<!-- ========================== Flowscript ================================= -->
@@ -60,7 +70,7 @@
<map:component-configurations>
<global-variables>
- <staging>./repo/</staging>
+ <staging>repository:./repo/</staging>
</global-variables>
</map:component-configurations>
@@ -101,19 +111,10 @@
<!-- ========================= Public Resources =========================== -->
- <!--
- <map:pipeline type="event-caching">
- -->
+ <!--map:pipeline type="event-caching"-->
+
<map:pipeline type="caching">
- <map:match pattern="test">
- <map:generate src="proppatch.xml" />
- <map:transform src="styles/proppatch2propwrite.xsl">
- <map:parameter name="location" value="test" />
- </map:transform>
- <map:serialize type="xml" />
- </map:match>
-
<map:match pattern="repo">
<map:call function="selectMethod">
<map:parameter name="page" value=""/>
@@ -132,6 +133,7 @@
</map:match>
<map:generate type="traverse" src="{global:staging}{1}">
<map:parameter name="depth" value="1"/>
+ <map:parameter name="dateFormat" value="EEE, d MMM yyyy HH:mm:ss Z" />
</map:generate>
<map:transform src="styles/collection2html.xsl">
<map:parameter name="requestURI" value="{request:requestURI}" />
@@ -143,6 +145,7 @@
<map:match pattern="PROPFIND/**">
<map:generate type="traverse" src="{global:staging}{1}">
<map:parameter name="depth" value="{request-header:Depth}" />
+ <map:parameter name="dateFormat" value="EEE, d MMM yyyy HH:mm:ss Z" />
</map:generate>
<map:transform src="styles/collection2propfind.xsl">
<map:parameter name="requestURI" value="{request:requestURI}" />
@@ -151,13 +154,9 @@
</map:match>
<map:match pattern="OPTIONS/**">
- <map:act type="set-header">
- <map:parameter name="DAV" value="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:call function="options">
+ <map:parameter name="uri" value="{request:requestURI}" />
+ </map:call>
</map:match>
<map:match pattern="HEAD/**">
@@ -203,26 +202,29 @@
</map:match>
<map:match pattern="COPY/**">
- <map:call function="copy">
- <map:parameter name="from" value="{global:staging}{1}" />
- <map:parameter name="to" value="{request-header:Destination}" />
- </map:call>
+ <map:match pattern="http://*/**" type="destination">
+ <map:call function="copy">
+ <map:parameter name="from" value="{global:staging}{../1}" />
+ <map:parameter name="to" value="{global:staging}/{2}" />
+ </map:call>
+ </map:match>
</map:match>
<map:match pattern="MOVE/**">
- <map:call function="move">
- <map:parameter name="from" value="{global:staging}{1}" />
- <map:parameter name="to" value="{request-header:Destination}" />
- </map:call>
+ <map:match pattern="http://*/**" type="destination">
+ <map:call function="move">
+ <map:parameter name="from" value="{global:staging}{../1}" />
+ <map:parameter name="to" value="{global:staging}/{2}" />
+ </map:call>
+ </map:match>
</map:match>
<map:match pattern="PROPPATCH/**">
<map:generate type="stream" />
- <map:transform src="styles/proppatch2propwrite.xsl" />
+ <map:transform src="styles/proppatch2propwrite.xsl">
+ <map:parameter name="location" value="{global:staging}{1}" />
+ </map:transform>
<map:transform type="spw" />
- <!--
- <map:transform src="styles/propwrite2proppatch.xsl" />
- -->
<map:serialize type="xml" />
</map:match>
1.4 +31 -0 cocoon-2.1/src/blocks/webdav/samples/davmap/webdav.js
Index: webdav.js
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/blocks/webdav/samples/davmap/webdav.js,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- webdav.js 30 Oct 2003 17:08:34 -0000 1.3
+++ webdav.js 3 Nov 2003 08:37:25 -0000 1.4
@@ -73,3 +73,34 @@
cocoon.log.error("status/500",{message:""});
}
}
+
+function options() {
+ cocoon.response.setHeader("DAV","1");
+ var options = "OPTIONS,GET,HEAD,POST,DELETE,TRACE,PUT"
+ + ",MKCOL,PROPFIND,PROPPATCH,COPY,MOVE";
+ cocoon.response.setHeader("Allow",options);
+}
+
+/*
+function getDestination() {
+ var destination = cocoon.request.getHeader("Destination");
+ var index = destination.indexOf('://');
+ if (index != -1) {
+ destination = destination.substring(index+3);
+ index = destination.indexOf('/');
+ if (index != -1) {
+ destination = destination.substring(index);
+ }
+ }
+ return destination;
+}
+
+function getUserAgent() {
+ var userAgent = cocoon.request.getHeader("User-Agent");
+ var index = userAgent.indexOf('/');
+ if (index != -1) {
+ return userAgent.substring(0,index);
+ }
+ return userAgent;
+}
+*/
\ No newline at end of file