This example demonstrates how to develop RESTful WebDAV services with WebDAV Support for JAX-RS. It is applying the WebDAV Interoperability Filter to provide interoperability with Microsoft's various WebDAV clients, and employs an embedded Grizzly server and an embedded Derby database for simplicity. The Java Persistence API (JPA) is utilized to access that database.
To understand the example's source code, JPA knowledge is not essential (just ignore the JPA parts to learn about the WebDAV parts). Neither is it necessary to be familiar with neither Grizzly nor Derby. On the other hand, it must be clear that at least a basic understanding of JAX-RS is needed, as this example is not for learning JAX-RS but solely for learning WebDAV Support for JAX-RS.
The mapping of the URI path space is presented in the following table:
|URI Path||Maps to Resource Class||Processes HTTP Methods (including WebDAV)|
|/addressbook||AddressBook.class||OPTIONS, GET, PUT, PROPFIND, PROPPATCH, MOVE, COPY, LOCK and UNLOCK|
The source code is stored in java.net's Subversion repository. Download it using your favorite Subversion client.
Execute the following command the the command line:
svn checkout https://svn.java.net/svn/webdav-addressbook~svn/trunk webdav-addressbook
Run the example as follows:
This example was tested using Microsoft's "WebDAV-Mini-Redirector" (i. e. the NET USE command) of Windows® XP Home SP 3, Windows Vista® Business SP 2 and Windows® 7 Professional SP 1. If you also want to use these particular clients (or others from Microsoft), please note that those contain lots of bugs (see http://greenbytes.de/tech/webdav/webdav-redirector-list.html. The following sequence was tested and worked well with that clients, but it was needed to allow the operating system to access unencrypted HTTP targets (HTTP instead of HTTPS) and other tweaks. Please consult your favourite search engine to learn about all the tricks needed to get applied locally on your particular edition and service pack of the Windows operating system, as the WebDAV Interoperability Filter only solves protocol bugs, but certainly cannot fix your local client configuration.
NET USE * http://localhost/addressbook DIR Z: COPY C:\x.adr Z:\y.adr COPY Z:\y.adr Z:\z.adr COPY Z:\z.adr C:\z.adr TYPE Z:\z.adr EDIT Z:\z.adr DEL Z:\y.adr REN Z:\z.adr a.adr MOVE Z:\a.adr Z:\b.adr EXPLORER Z:\
To repeat this example, you need the file x.adr or similar: It is found in the root folder of this example's source code.
Windows® and Windows Vista® are either a registered trademark or trademark of Microsoft Corporation in the United States and / or other countries. Please find more information on using those trademarks on the web site of Microsoft Corporation.