New WebDAV Ruby On Rails Plugin Release

January 6th, 2007

I’ve finally had some time over the holidays to put together a new release of the RailsDAV plugin for WebDAV functionality in Rails.

It’s still really a 0.0.2 release as bugs are to be fixed and still havn’t nailed a structure for the plugin i’m happy with. But for now I have improved the structure and implemented some fixes courtesy of Albert Ramstedt. Thanks Albert.

As such the use of RailsDAV plugin has changed a bit and it won’t be backwards compatible so scan the code if you are using it.

The act_as_railsdav method is attached to ActionController and can be used by calling act_as_railsdav on a controller


 class MyDavController < ActionController::Base
    act_as_railsdav

The controller must then have a route of

map.connect 'mydav/*path_info', :controller => 'my_dav', :action => 'webdav'

It is then necessary to implement some or all of the following methods:

get_resource_for_path needs to return a WebDAVResource object such as FileWebDavResource

To add webdav authentication to your controller just use


class MyDavController < ActionController::Base
   act_as_railsdav
   before_filter :my_auth

   def my_auth()
       basic_auth_required |username, password| do
          session[:user] = User.your_authentication(username,password)
       end
   end

Additionally you can add a simple filesystem expose to a controller by:


 class FileDavController < ActionController::Base
    act_as_filewebdav :base_dir => 'public'
 end

The new version of the plugin can be donwloaded using
svn co http://svn.liverail.net/svn/plugins/railsdav
It also requires the following gems

I’m going to spend a lot more time on RailsDAV now so let me know what you want out of it!

17 Responses to “ New WebDAV Ruby On Rails Plugin Release”

  1. Fabien Franzen Says:

    Nice work Stuart! I still have a need for WebDAV in Rails, so I will be using your plugin in the near future. I’m sorry I wasn’t able to contribute (yet), I’ve been awfully busy. Also, I’m starting out using Flex with Rails as well.

  2. Tony Says:

    This is looking good, thanks! All it needs for me is ability to set the base_dir dynamically. :)

  3. Stuart Eccles Says:

    yep thats in the TODOs ;-)

  4. Michael Says:

    Thanks Stuart. I’ m really looking forward to the next RailsDAV release and it’s good to read, that you will work on improvements. Keep on your great work.

  5. Linkfelhő Says:

    Thanks for it. I’m looking forward to the next release too.

  6. Martin Says:

    Hi there. This looks really useful. I noticed that in your description of the new version, you don’t mention the ActiveRecord exposer which existed in versions past. Any plans to support that again? That’d really be awesome thing to have for many Rails apps, I’m sure.

    Many thanks and please keep up the good work!

  7. Stuart Eccles Says:

    The active record version was always meant more of an example as how to use railsdav to expose things other than directories over webdav rather than anything really useful. I might be tempted to do some other clever active record things as examples if people are interested.

  8. Martin Says:

    Definitely interested. Thanks!

  9. rot Says:

    has anyone tested this with the windows xp webdav clients (there are 2 – one that comes when you specify a port – the other one when you don´t). the only way i found out that it works is when you use the one that works with the port specified. And this one only seems to work when you use mongrel or something similar directly or with a proxy in front not in a fastcgi setup because apache doesn´t let the rails app answer the http options request (well that´s an apache problem but still its not so comfortable)

  10. Stuart Eccles Says:

    Yes there has been a lot of testing on windows. I think the problem is with the apache setup but i have run a successfully before using a Lighttpd FCGI setup behind an apache proxy but i’ll try to test it out with a few different setups.

  11. Albert Ramstedt Says:

    Oh, I just found this post! Thanks for mentioning me. I sortof abandoned the ServeWebdav gem, so its good that you found it useful. I have tested the ServeWebdav gem on macs and windows default/netdrive, and it worked pretty good. I never really got performance to an acceptable level for my own use (mapping AR).

  12. 3d Says:

    Thank you!

  13. lars Says:

    Definitely interested. Thanks!

  14. Daniel Says:

    To be able to handle large files, getting the contents streamed to a yield-block would be nice. Do you already have a version of webdav_put() that does this? A test for respond_to?(:webdav_put_streamed) would probably be enough.

  15. Barney Says:

    Great stuff so far. What about security? Is there a way to use https with filedav?

    Cheers

  16. Jim Says:

    Hi!

    How do I upload a whole folder containing multiple files?

    I cannot figure it out!

    Thanks

  17. seo Says:

    本当にいいですね。

Leave a Reply