Bertrand Delacretaz wrote:

If I'm right, this would allow Cocoon to proxy most WebDAV operations to a non-DASL WebDAV backend, and process the few operations that relate to properties (PROPFIND, PROPPATCH, SEARCH) directly, storing properties in a database.

This was an itch I just had to scratch. :-) I have now committed to the proxy block a new ProxyGenerator that takes whatever method and forwards it to an origin server specified as a sitemap parameter. To do so, I had to put together a new httpclient method (I'm wondering if the httpclient team might be interested in it once polished...) that clones an incoming HttpServletRequest and makes a call to an origin server. So far I've tried it with cadaver and skunkdav, surprisingly enough it seems to work with all the webdav methods.


We have a starting point then, but beware:

1. header handling is *hacky*. I had to filter by hand some headers in order to make the application behave (don't ask me why, but Content-Length in the Cocoon proxied response was off by one byte);

2. no HTTP/1.1 keepalive. I see no way of handling it in Cocoon, since every request has to go through the pipeline, and the response OutputStream cannot be reused. This might be a major performance hit.

Anyway, it's there for you to play. :-) To access a DAV repository running at localhost on port 81 under the /dav context, all you have to do is

    <map:generator label="content"
         logger="sitemap.generator.proxy"
         name="generic-proxy"
         src="org.apache.cocoon.generation.GenericProxyGenerator"/>


[...]


    <map:match pattern="dav/">
        <map:generate type="generic-proxy">
          <map:parameter name="url" value="http://localhost:81/dav/"/>
          <map:parameter name="path" value="/dav/"/>
        </map:generate>
        <map:serialize type="xml"/>
    </map:match>

    <map:match pattern="dav/**">
        <map:generate type="generic-proxy">
          <map:parameter name="url" value="http://localhost:8881/dav/"/>
          <map:parameter name="path" value="/dav/{1}"/>
        </map:generate>
        <map:serialize type="xml"/>
    </map:match>

Anyone willing to tackle DASL searches now? :-)

Ciao,

--
Gianugo Rabellino
Pro-netics s.r.l. -  http://www.pro-netics.com
Orixo, the XML business alliance - http://www.orixo.com
    (Now blogging at: http://blogs.cocoondev.org/gianugo/)



Reply via email to