caucho
Resin
FAQ
Reference Guide
Demo
Tutorial

Getting Started
Configuration
IDE
Topics
JSP
XML/XSLT

Virtual Hosts
Balancing
Distributed Sessions
Caching
JavaScript
Filters
Servlets
Admin
WebDAV
Velocity
EJB Clients
JMX
Burlap
Hessian
 WebDAV

Admin
Topics
Velocity

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.

From www.webdav.org:

What is WebDAV?
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.

The WebDAV site also contains pointers to programs which understand WebDAV.

Configuring the WebDAV Servlet

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.

namemeaningdefault
enableEnable webdav servlet for read/writedisabled
roleThe role required for webdav, '*' means no role requiredwebdav
userA specific user required for webdavnone
secureIf true, only allow updates over a secure connection (SSL)true
rootConfigures the root directory for webdavThe application root
path-sourceAllows a custom path backing, e.g. a database sourcecom.caucho.http.webdav.ApplicationPath

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

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

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

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

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

The WebDAV servlet can point to a different directory by setting the 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:

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

Configuring Windows

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

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".

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.

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.

Custom Path Sources

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.

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

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

Admin
Topics
Velocity
Copyright © 1998-2002 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark, and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.