Package it.could.webdav

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

See:
          Description

Interface Summary
DAVListener A simple interface identifying a DAVRepository event listener.
DAVMethod An interface describing the implementation of a WebDAV method.
 

Class Summary
DAVInputStream A specialized InputStream to read from DAVResources.
DAVLogger A simplicisting class defining an esay way to log stuff to the ServletContext.
DAVOutputStream A specialized OutputStream to write to DAVResources.
DAVProcessor The WebDAV transactions processor.
DAVRepository A simple class representing a File based WebDAV repository.
DAVResource A simple representation of a WebDAV resource based on Files.
DAVServlet A very simple servlet capable of processing very simple WebDAV requests.
DAVTransaction A simple wrapper isolating the Java Servlet API from this WebDAV implementation.
DAVUtilities A collection of static utilities.
XMLRepository A DAVRepository instance enforcing all DAVResources to be XML files.
 

Exception Summary
DAVException A RuntimeException representing a WebDAV response for a specified DAVResource.
DAVMultiStatus A DAVException representing a WebDAV 207 (Multi-Status) response.
DAVNotModified A simple DAVException encapsulating an HTTP not modified response.
 

Package it.could.webdav Description

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 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 DAVServlet class, which will handle all HTTP and WebDAV requests for the URI path it is configured to handle.

To operate properly the 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 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 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 ServletContext as this this implementation requires a File based repository.
xmlOnly
[optional, default="false"] This parameter will instruct the 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 DAVServlet to log unimportant debugging information (such as the methods called by the client) in the context log.

The configured 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.