Plugins You can find out about all the publicly available Grails plugins.

Webdav Plugin

  • Tags: functionality, webdav
  • Latest: 0.3.1
  • Last Updated: 03 January 2011
  • Grails version: 1.1 > *
  • Authors: null
0 vote
compile ":webdav:0.3.1"




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:

  • 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/*', ]
A webdav share with the internal name 'webdav' is accessible under http://localhost:8080/<app>/webdav

Example 2:

grails.webdav =  [
        webdav1: [ url: '/webdav_folder1/*' ],
        webdav2: [ url: '/webdav_folder2/*' ],
        webdav3: [
            url: '/filesystemview/*,
            init: [
                storeDebug: 1,
                'no-content-length-headers': 0,
                lazyFolderCreationOnPut: 0


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.

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.groovy

So 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 = {
	      constraints {
			 // apply constraints here
      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.


  • 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
    • fixes
  • 2009-02-20: released initial 0.1 version