Permalink
Browse files

added propfind and get handlers

  • Loading branch information...
1 parent 00c57ca commit a7f2e813435f0a99cd7ccb653e489a79be558663 erik committed Feb 10, 2010
Showing with 126 additions and 0 deletions.
  1. +26 −0 webdav/get.xml
  2. +100 −0 webdav/propfind.xml
View
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
+ <meta>
+ <author>Erik Eldridge</author>
+ <description>
+ </description>
+ <sampleQuery></sampleQuery>
+ </meta>
+ <bindings>
+ <select produces="XML">
+ <inputs>
+ <key id="path" type="xs:string" paramType="variable"/>
+ </inputs>
+ <execute><![CDATA[
+ response.object = function () {
+
+ //fetch 'files'
+ var query = 'select * from yql.storage where name="store://FOUBAHrTP9vFVB2k8E2jEE"',
+ results = y.xmlToJson(y.query(query).results);
+
+ return results.results.result.value[path];
+ }();
+ ]]></execute>
+ </select>
+ </bindings>
+</table>
View
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
+ <meta>
+ <author>Erik Eldridge</author>
+ <description>
+ </description>
+ <sampleQuery></sampleQuery>
+ </meta>
+ <bindings>
+ <select produces="XML">
+ <inputs></inputs>
+ <execute><![CDATA[
+ response.object = function () {
+
+ //fetch 'files'
+ var query = 'select * from yql.storage where name="store://FOUBAHrTP9vFVB2k8E2jEE"',
+ results = y.xmlToJson(y.query(query).results);
+
+ //for each file in files
+ var xml = <D:multistatus xmlns:D="DAV:"/>;
+ xml.appendChild(<D:response xmlns:D="DAV:" xmlns:lp1="DAV:" xmlns:lp2="http://apache.org/dav/props/">
+ <D:href>/webdav/</D:href>
+ <D:propstat>
+ <D:prop>
+ <lp1:resourcetype>
+ <D:collection/>
+ </lp1:resourcetype>
+ <lp1:creationdate>2010-01-02T19:43:01Z</lp1:creationdate>
+ <lp1:getlastmodified>Sat, 02 Jan 2010 19:43:01 GMT</lp1:getlastmodified>
+ <lp1:getetag>"19013d-1000-b2283b40"</lp1:getetag>
+ <D:supportedlock>
+ <D:lockentry>
+ <D:lockscope>
+ <D:exclusive/>
+ </D:lockscope>
+ <D:locktype>
+ <D:write/>
+ </D:locktype>
+ </D:lockentry>
+ <D:lockentry>
+ <D:lockscope>
+ <D:shared/>
+ </D:lockscope>
+ <D:locktype>
+ <D:write/>
+ </D:locktype>
+ </D:lockentry>
+ </D:supportedlock>
+ <D:lockdiscovery/>
+ <D:getcontenttype>httpd/unix-directory</D:getcontenttype>
+ </D:prop>
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:propstat>
+ </D:response>);
+
+ for (var file in results.results.result.value) {
+
+ xml.appendChild(<D:response xmlns:D="DAV:" xmlns:lp1="DAV:" xmlns:lp2="http://apache.org/dav/props/">
+ <D:href>/webdav/{file}</D:href>
+ <D:propstat>
+ <D:prop>
+ <lp1:resourcetype/>
+ <lp1:creationdate>2010-01-02T19:43:01Z</lp1:creationdate>
+ <lp1:getcontentlength>0</lp1:getcontentlength>
+ <lp1:getlastmodified>Sat, 02 Jan 2010 19:43:01 GMT</lp1:getlastmodified>
+ <lp1:getetag>"19013f-0-b2283b40"</lp1:getetag>
+ <lp2:executable>F</lp2:executable>
+ <D:supportedlock>
+ <D:lockentry>
+ <D:lockscope>
+ <D:exclusive/>
+ </D:lockscope>
+ <D:locktype>
+ <D:write/>
+ </D:locktype>
+ </D:lockentry>
+ <D:lockentry>
+ <D:lockscope>
+ <D:shared/>
+ </D:lockscope>
+ <D:locktype>
+ <D:write/>
+ </D:locktype>
+ </D:lockentry>
+ </D:supportedlock>
+ <D:lockdiscovery/>
+ <D:getcontenttype>text/plain</D:getcontenttype>
+ </D:prop>
+ <D:status>HTTP/1.1 200 OK</D:status>
+ </D:propstat>
+ </D:response>);
+
+ }
+
+ return xml;
+ }();
+ ]]></execute>
+ </select>
+ </bindings>
+</table>

0 comments on commit a7f2e81

Please sign in to comment.