This package contains a minimal Servlet based implementation of the WebDAV specification.

This implementation does not in any way try to replace or extend the Apache Slide WebDAV implementation, but tries to provide a very light and extremely minimal alternative to be used in those scenarios where space is a constraint (the .jar file is less than 100 kylobites), and advanced features are not required.

The most visible limitations of this approach is that this implementation does not offer any support for the LOCK method (it is therefore not DAV Level 2 compliant), and that there limited support for properties:

Another important limitation is that this implementation will only and exclusively provide access to a {@link java.io.File} based backend. If you want to deploy your repository on another kind of backend (such as SQL databases) please look at the WebDAV implementation provided by Apache Slide.

Configuration

The main entry point of this implementation is defined in the {@link it.could.webdav.DAVServlet} class, which will handle all HTTP and WebDAV requests for the URI path it is configured to handle.

To operate properly the {@link it.could.webdav.DAVServlet} class must be configured in the web-application's web.xml deployment descriptor. The relevant parts of a snippet of an example configuration deployment descriptor might look like the following:

<servlet>
  <servlet-name>dav</servlet-name>
  <servlet-class>it.could.webdav.DAVServlet</servlet-class>
  <init-param>
    <param-name>rootPath</param-name>
    <param-value>dav</param-value>
  </init-param>
  <init-param>
    <param-name>xmlOnly</param-name>
    <param-value>false</param-value>
  </init-param>
  <init-param>
    <param-name>debugEnabled</param-name>
    <param-value>false</param-value>
  </init-param>
  <load-on-startup>1</load-on-startup>
</servlet>

...

<servlet-mapping>
  <servlet-name>dav</servlet-name>
  <url-pattern>/dav/*</url-pattern>
</servlet-mapping>
    

In this example the {@link it.could.webdav.DAVServlet} servlet is configured with all parameters its parameters:

rootPath
[required] This parameter indicates the path of the root of the repository.
If the specified parameter represents a relative path, it will be treated as a {@link javax.servlet.ServletContext#getResource(String) ServletContext resource}.
Note that if you choose to distribute your web application in a .war archive, your container will have to expand it before intializing the {@link javax.servlet.ServletContext} as this this implementation requires a {@link java.io.File} based repository.
xmlOnly
[optional, default="false"] This parameter will instruct the {@link it.could.webdav.DAVServlet} to create a very specialized version of the repository accepting only well-formed XML resources and collections.
Note that when set to true this implementation will rely on the JAXP specification to access a XML parser used to verify the PUT content.
debugEnabled
[optional, default="false"] This parameter will instruct the {@link it.could.webdav.DAVServlet} to log unimportant debugging information (such as the methods called by the client) in the {@link javax.servlet.ServletContext#log(String) context log}.

The configured {@link it.could.webdav.DAVServlet} will then have to be mapped to a path, and in the example above, every request for any URL beginning in /dav/ will be handled by this implementation, with a repository rooted in the /dav/ directory of the web application.