<s1 title="WebDAV">

<p>WebDAV, web-based distributed authoring and versioning, is a
convenient replacement for FTP when developing web sites.  Many
editing tools can save to a WebDAV server directly and several
operating systems can provide a filesystem to a WebDAV server.</p>

<p>From <a href="http://www.webdav.org">www.webdav.org</a>:
<blockquote>
<b>What is WebDAV?</b><br/>

Briefly: WebDAV stands for "Web-based Distributed Authoring and Versioning".
It is a set of extensions to the HTTP protocol which allows users to
collaboratively edit and manage files on remote web servers.
</blockquote>

<p>The WebDAV site also contains pointers to programs which
understand WebDAV.</p>

<s2 title='Configuring the WebDAV Servlet'>

<p>The WebDAV servlet must be enabled explicitly.  By default, it also
requires a logged in user playing the 'webdav' role and requires a
secure (SSL) connection.  These can be relaxed, but having
the defaults require security makes it unlikely that a webmaster will
enable WebDAV by mistake.</p>

<deftable>
<tr><th>name<th>meaning<th>default
<tr><td>enable<td>Enable webdav servlet for read/write<td>disabled
<tr><td>role<td>The role required for webdav, '*' means no role required<td>webdav
<tr><td>user<td>A specific user required for webdav<td>none
<tr><td>secure<td>If true, only allow updates over a secure connection
(SSL)<td>true
<tr><td>root<td>Configures the root directory for webdav<td>The application root
<tr><td>path-source<td>Allows a custom path backing, e.g. a database source<td>com.caucho.http.webdav.ApplicationPath
</deftable>

<p>The following example is a typical WebDAV configuration.  The explicit
servlet-mapping and setting enable to 'write' is necessary.  Since
<var/secure/> is left as the default, it will require an SSL connection.</p>

<example>
&lt;servlet-mapping url-pattern='/webdav/*'
                    servlet-name='com.caucho.http.webdav.WebDavServlet'>
  &lt;init-param enable='write'/>
&lt;/servlet-mapping>

&lt;login-config auth-method='basic'>
  &lt;authenticator>
    &lt;class-name>com.caucho.http.security.XmlAuthenticator&lt;/class-name>
    &lt;init-param user='Harry Potter:quidditch:webdav'/>
  &lt;/authenticator>
&lt;/login-config>
&lt;security-constraint url-pattern='/webdav/*' role-name='webdav'/>
</example>

<p>The following example is not recommended because it would allow anyone to
update the site:</p>

<example title="WebDAV with no security">
&lt;servlet-mapping url-pattern='/webdav/*'
                    servlet-name='com.caucho.http.webdav.WebDavServlet'>
  &lt;init-param enable='write'/>
  &lt;init-param secure='false'/>
  &lt;init-param role='*'/>
&lt;/servlet-mapping>
</example>

<p>The WebDAV servlet can point to a different directory by
setting the <var/root/> init-param.  The path is relative to the
web-app, and allows path variables.  For example, the following would
read and write files from WEB-INF/webdav:</p>

<example title="WebDAV based on WEB-INF/webdav">
&lt;servlet-mapping url-pattern='/webdav/*'
                    servlet-name='com.caucho.http.webdav.WebDavServlet'>
  &lt;init-param root='WEB-INF/webdav'/>
  &lt;init-param enable='write'/>
  &lt;init-param role='webdav'/>
&lt;/servlet-mapping>
</example>

</s2>

<s2 title='Configuring Windows'>

<p>Recent versions of Windows and the Windows Office suite directly
support WebDAV.  WebDAV is configured in "My Network Places".</p>

<p>When browsing "My Network Places" in IE, click on Tools/Map Network
Drive from the menu.  IE will open a dialog.  The dialog contains a
link to "Create a shortcut to Web folder or FTP site".  Clicking on
that will open the "Add Network Place Wizard".</p>

<p>The Add Network Place Wizard will ask for the location of the
WebDAV server.  Type the full URL, e.g. http://www.foo.com/webdav and
complete the dialog.</p>

<p>Adding the WebDAV link will let you save directly to your server.
Windows programs can load and save to the server.  You can also open an
IE window to the mapped folder and use it as a normal folder.</p>

</s2>

<s2 title='Custom Path Sources'>

<p>The WebDAV servlet can be customized to use a source other than the
default path source.  For example, it would be possible to use WebDAV
with files stored in a database.  The custom class must extend
com.caucho.http.webdav.AbstractPath.</p>

<example title="WebDAV with a custom source">
&lt;resource-ref res-ref-name='resin/webdav'>
  &lt;class-name>test.foo.MyDataSource&lt;/class-name>
  &lt;init-param my-foo='bar'/>
&lt;/resource-ref>

&lt;servlet-mapping url-pattern='/webdav/*'
                    servlet-name='com.caucho.http.webdav.WebDavServlet'>
  &lt;init-param enable='write'/>
  &lt;init-param path-source='resin/webdav'/>
&lt;/servlet-mapping>
</example>

</s2>
</s1>
