package org.apache.catalina.servlets;
import static org.jboss.web.CatalinaMessages.MESSAGES;
Servlet which adds support for WebDAV level 2. All the basic HTTP requests
are handled by the DefaultServlet. The WebDAVServlet must not be used as the
default servlet (ie mapped to '/') as it will not work in this configuration.
To enable WebDAV for a context add the following to web.xml:
<servlet>
<servlet-name>webdav</servlet-name>
<servlet-class>org.apache.catalina.servlets.WebdavServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>listings</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>webdav</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
This will enable read only access. To enable read-write access add:
<init-param>
<param-name>readonly</param-name>
<param-value>false</param-value>
</init-param>
To make the content editable via a different URL, using the following
mapping:
<servlet-mapping>
<servlet-name>webdav</servlet-name>
<url-pattern>/webdavedit/*</url-pattern>
</servlet-mapping>
Don't forget to secure access appropriately to the editing URLs. With this
configuration the context will be accessible to normal users as before. Those
users with the necessary access will be able to edit content available via
http://host:port/context/content using
http://host:port/context/webdavedit/content
- Author(s):
- Remy Maucherat
- Version:
- $Revision: 1739 $ $Date: 2011-06-14 16:56:59 +0200 (Tue, 14 Jun 2011) $
PROPFIND - Specify a property mask.
PROPFIND - Display all properties.
PROPFIND - Return property names.
Default lock timeout value.
Simple date format for the creation date ISO representation (partial).
MD5 message digest provider.
The MD5 helper object for this class.
Repository of the locks put on single resources.
Key : path
Value : LockInfo
Repository of the lock-null resources.
Key : path of the collection containing the lock-null resource
Value : Vector of lock-null resource which are members of the
collection. Each element of the Vector is the path associated with
the lock-null resource.
Vector of the heritable locks.
Key : path
Value : LockInfo
Secret information used to generate reasonably secure lock ids.
Default depth in spec is infinite. Limit depth to 3 by default as
infinite depth makes operations very expensive.
Return JAXP document builder instance.
documentBuilderFactory = DocumentBuilderFactory.newInstance();
Handles the special WebDAV methods.
log("[" + method + "] " + path);
Check if the conditions specified in the optional If headers are
satisfied.
- Parameters:
request
The servlet request we are processingresponse
The servlet response we are creatingresourceAttributes
The resource information- Returns:
- boolean true if the resource meets all the specified conditions,
and false if any of the conditions is not satisfied, in which case
request processing is stopped
Override the DefaultServlet implementation and only use the PathInfo. If
the ServletPath is non-null, it will be because the WebDAV servlet has
been mapped to a url other than /* to configure editing at different url
than normal viewing.
- Parameters:
request
The servlet request we are processing
if ((result == null) || (result.equals("")))
if ((result == null) || (result.equals(""))) {
} else if (depthStr.equals("1")) {
} else if (depthStr.equals("infinity")) {
for (int i=0; i < childList.getLength(); i++) {
for (int i=0; i < childList.getLength(); i++) {
if (currentLockNullResources != null) {
if (lockNullPath.equals(path)) {
(req, generatedXML, lockNullPath, type,
while ((!stack.isEmpty()) && (depth >= 0)) {
if ((object instanceof DirContext) && (depth > 0)) {
stackBelow.push(newPath);
String lockPath = currentPath;
if (currentLockNullResources != null) {
(req, generatedXML, lockNullPath, type,
Process a POST request for the specified resource.
if (lockDurationStr == null) {
int commaPos = lockDurationStr.indexOf(",");
lockDurationStr = lockDurationStr.substring(0,commaPos);
Node lockInfoNode = null;
lockInfoNode = rootElement;
if (lockInfoNode != null) {
Node lockScopeNode = null;
Node lockTypeNode = null;
Node lockOwnerNode = null;
for (int i=0; i < childList.getLength(); i++) {
lockScopeNode = currentNode;
lockTypeNode = currentNode;
lockOwnerNode = currentNode;
if (lockScopeNode != null) {
for (int i=0; i < childList.getLength(); i++) {
if (tempScope.indexOf(':') != -1) {
if (lock.scope == null) {
if (lockTypeNode != null) {
for (int i=0; i < childList.getLength(); i++) {
if (lockOwnerNode != null) {
for (int i=0; i < childList.getLength(); i++) {
domWriter.print(currentNode);
if (lock.owner == null) {
+ lock.depth + "-" + lock.owner + "-" + lock.tokens + "-"
if ( (exists) && (object instanceof DirContext) &&
if (currentLock.path.equals(lock.path)) {
if (presentLock != null) {