Webdav Plugin
Dependency :
compile ":webdav:0.3.1"
Summary
Description
This plugin provides a webdav interface for grails. It's core functionalitiy is to provide support for exposing your domain model to a webdav interface. This is especially useful when your domain objects contain binary data to be edited with a locally install application, e.g. word documents, images, etc.For the underlying webdav stuff, the webdav-servlet project is used. Thanks to those folks for providing a open source webdav servlet implementation.The plugin code itself is nothing more than a small integration layer between Grails and the Webdav Servlet. In details, it provides:
A webdav share with the internal name 'webdav' is accessible under http://localhost:8080/<app>/webdavExample 2:
Provides three webdav shares: webdav1 maps to http://localhost:8080/<app>/webdav_folder1
and webdav2 maps to http://localhost:8080/<app>/webdav_folder2. The third one provides
some servlet init parameters.
- autoconfiguration of the webdav servlet by adding the necessary stuff in web.xml
- an implementation of IWebdavStore for Grails's needs
- a customized WebdavServlet
- an abstract base class for creating your own WebdavMapper implementation.
I'd appreciate any feedback on the plugin. Use the grails-user mailinglist for this.
How to use the plugin
To use webdav in your app you need to take the following steps:1. install the webdav plugin in your application
grails install-plugin webdav
2. add a webdav definition part to your Config.groovy file:
Example 1:grails.webdav = [
webdav: [ url: '/webdav/*', ]
]grails.webdav = [
webdav1: [ url: '/webdav_folder1/*' ],
webdav2: [ url: '/webdav_folder2/*' ],
webdav3: [
url: '/filesystemview/*,
init: [
rootpath: System.properties.'java.io.tmpdir',
storeDebug: 1,
'no-content-length-headers': 0,
lazyFolderCreationOnPut: 0
] ]3. add a service class extending AbstractWebdavMapperService for each entry in your webdav configuration. This class defines the contents of your webdav shares.
There's a special naming convention for these service classes: WebdavMapper_<internalname>Service.groovySo for the above example 1 you have to implement WebdavMappper_webdavService, for example 2 you need WebdavMapper_webdav1Service and WebdavMapper_webdav2Service. These service should be in the root package (aka no package declaration). For a sample implementation of a WebdavMapper, take a look in the sample application.If the plugin does not find your service class for a specific webdav share, it falls back and uses the net.sf.webdav.LocalFileSystemStore to expose a local directory to webdav.4. prevent Grails UrlMapping acting on Webdav-URLs
add an exlcude setting in your UrlMappings.groovy Example:class UrlMappings {
static mappings = {
"/$controller/$action?/$id?"{
constraints {
// apply constraints here
}
}
"500"(view:'/error')
static excludes = ["/webdav_folder1*"] // repeat this one for each of your webdav shares
}Sample application
In SVN there's a short sample application showing the basic usage of the plugin. You can also download the sample application as a zip archive.Todo
- add some gant scripts to automate the manual steps above
- care about authentication in webdav
- care about timestamps of the webdav-enabled objects
Release history
- 2011-01-03: released 0.3.1 version
- applied patch provided by GRAILSPLUGINS-2716
- 2010-05-30: released 0.3 version
- bugfix release based on several JIRAs: see release notes for a list of bugs fixed.
- 2009-08-26: released 0.2 version,
- fixes http://jira.codehaus.org/browse/GRAILSPLUGINS-1449
- fixes http://jira.codehaus.org/browse/GRAILSPLUGINS-1450
- 2009-02-20: released initial 0.1 version
Resources
- SVN: https://svn.codehaus.org/grails-plugins/grails-webdav/
- Jira issue tracker: http://jira.codehaus.org/browse/GRAILSPLUGINS, please use component 'Grails-webdav'.