blob: 92f023c86b6fc834b7f7ab45ddc83daac80caff0 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<title>Apache Wink : 5.6 WebDAV Extension</title>
<link rel="stylesheet" href="styles/site.css" type="text/css" />
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<table class="pagecontent" border="0" cellpadding="0" cellspacing="0" width="100%" bgcolor="#ffffff">
<td valign="top" class="pagebody">
<div class="pageheader">
<span class="pagetitle">
Apache Wink : 5.6 WebDAV Extension
<div class="pagesubheading">
This page last changed on Oct 13, 2009 by <font color="#0050B2">michael</font>.
<h1><a name="5.6WebDAVExtension-WebDAVExtension"></a>WebDAV Extension</h1>
<p>Apache Wink provides an extension module for supporting the WebDAV protocol. The extension contains the complete WebDAV XML model and a WebDAV response builder for easing the process of creating a WebDAV multistatus response.</p>
<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Usful Information</b><br />The WebDAV extension is a single jar wink-webdav-&lt;version&gt;.jar, and it has no special dependencies.</td></tr></table></div>
<h2><a name="5.6WebDAVExtension-WebDAVDataModel"></a>WebDAV Data Model</h2>
<p>The WebDAV extension provides a Java data model that reflects the WebDAV XMLs defined in the WebDAV RFC. All classes of the data model are located in the org.apache.wink.webdav.model package.</p>
<h2><a name="5.6WebDAVExtension-WebDAVClasses"></a>WebDAV Classes</h2>
<p>The WebDAV extension provides several classes that applications can use in order to receive basic support for common WebDAV methods.</p>
<h3><a name="5.6WebDAVExtension-WebDAVModelHelper"></a>WebDAVModelHelper</h3>
<p>The WebDAVModelHelper class provides helper methods for XML marshaling and unmarshaling of the WebDAV data model classes. It also provides helper methods for creating generic properties as DOM element classes to populate the WebDAV Prop element.</p>
<h3><a name="5.6WebDAVExtension-WebDAVResponseBuilder"></a>WebDAVResponseBuilder</h3>
<p>The WebDAVResponseBuilder class is used in order to create responses to WebDAV PROPFIND requests. It takes a SyndEntry or SyndFeed as input in order to create the response.</p>
<h2><a name="5.6WebDAVExtension-ResourceMethodDefinition"></a>Resource Method Definition</h2>
<p>A resource method is defined to handle the desired WebDAV method by annotating it with one of the WebDAV method designators defined in the WebDAVMethod enum.<br/>
The supported WebDAV Http methods are as follows:</p>
<h2><a name="5.6WebDAVExtension-CreatingaMultistatusResponse"></a>Creating a Multistatus Response</h2>
<p>In order to create a <b>MULTISTATUS</b> response to a <b>PROPFIND</b> request the user can use the <b>WebDAVResponseBuilder</b> class, or create the response manually.</p>
<h3><a name="5.6WebDAVExtension-UsingWebDAVResponseBuilder"></a>Using WebDAVResponseBuilder</h3>
<p>In order to create a multistatus response using the <b>WebDAVResponseBuilder</b> class, call one of the propfind() methods.</p>
<p>The <b>WebDAVResponseBuilder</b> class also enables the user to provide the properties to include in the response by extending the PropertyProvider class, overriding the setPropertyValue() method and passing the property provider instance to the response builder propfind() method.</p>
<h3><a name="5.6WebDAVExtension-WebDAVResponseBuilderExample"></a>WebDAVResponseBuilder Example</h3>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="code-xml">
@Path(<span class="code-quote">"defects/{defect}"</span>)
public class DefectResource {
@Consumes(<span class="code-quote">"application/xml"</span>)
public Response propfindDefect(@PathParam(<span class="code-quote">"defect"</span>) String defected) {
SyndFeed feed = ...
return WebDAVResponseBuilder.propfind(feed);
<p>The propfindDefect() method is associated with the PROPFIND WebDAV Http method using the @WebDAVMethod.PROPFIND annotation.</p>
<p>When the propfindDefect() method is invoked, an instance of a org.apache.wink.common.model.synd.SyndFeed is created and passed to the WebDAVResponseBuilder.propfind() method in order to create the actual response.</p>
<h3><a name="5.6WebDAVExtension-ManualCreation"></a>Manual Creation</h3>
<p>In order to create a Multistatus response manually, perform the following steps:</p>
<li>Create a new org.apache.wink.webdav.model.Multistatus instance and set its fields according to the application logic.</li>
<li>Create a new instance, set the response code to MULTI_STATUS (207), and set its entity to be the Multistatus instance.</li>
<p>Return the Response instance from the resource method</p>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<td height="12" background=""><img src="images/border/spacer.gif" width="1" height="1" border="0"/></td>
<td align="center"><font color="grey">Document generated by Confluence on Nov 11, 2009 06:57</font></td>