views:

324

answers:

2

I am using RackDAV, and it's GREAT! http://github.com/georgi/rack_dav

However, the only way I can get it integrated into my Rails app is to modify my server startup file, which I copied from /vendor/rails/railties/rails/commands/server file! Obviously not great. I have this working:

app = Rack::Builder.new {
  use Rails::Rack::LogTailer unless options[:detach]
  use Rails::Rack::Debugger if options[:debugger]
  map map_path do

    use Rails::Rack::Static 
    run inner_app
  end
  map "/webdav/" do
    use Rack::ShowExceptions
    use Rack::CommonLogger
    use Rack::Reloader
    use Rack::Lint
    run RackDAV::Handler.new(:root => SOLR_CORES_FILESYSTEM)
  end
}.to_app

I want to be able to specify the handler elsewhere, like in environment.rb, but can't figure out how to have the mapping aspect work. Anyone hooked RackDAV into Rails?

A: 

You can call RackDAV from metal endpoint in Rails. I can show you example if you need it, but it is pretty straight forward.

retro
I'd love to see an example, I haven't been able to get one that would work in other environments where I am not starting using ./script/server. For example, using Warbler to build a war file.
Eric Pugh
A: 

Good evening,

Would you be so kind and explain me how to do this? I have been able to get rackdav going standalone but fail to get it going inside an existing app. I am using Rails 2.3.2 with many controllers in the classical way. I now want to add rackdav functionality, tied to /webdav and with a different :root depending on userid. The next thing I then want to do is to implement a custom resource, using data from an existing MySQL database. I know how to do this.

I tried to set up a metal handler which instantiates a RackDAV handler for each call and then performs the actual call(env). The problem is that ActionController is still invoked, which then return a 500 error because PROPFIND isn't supported. But I understand there should be a way to bypass ActionController altogether by using the Metal middleware.

Can you give me a hint please how to do this?

Thank you very much in advance, Frans

Frans Maas
I haven't found my old code that did it, so would be starting over! Good luck!
Eric Pugh