DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21288>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21288

DirContext caching problem with Dreamweaver 6 when recursively creating directories

           Summary: DirContext caching problem with Dreamweaver 6 when
                    recursively creating directories
           Product: Tomcat 4
           Version: 4.1.24
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Servlets:WebDAV
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I have a webdav enabled webapp in /webdav.
If I in Dreamweaver drag-drop a deep directory structure such as:

risk2/
risk2/character/
risk2/character/file.txt

And the risk2 directory does not exist under /webdav/.

The commands at one point issued are:
PROPFIND /webdav-www.boscom.com.preview.taglab.com/risk2 HTTP/1.1
HTTP/1.1 404
PROPFIND /webdav-www.boscom.com.preview.taglab.com/ HTTP/1.1
HTTP/1.1 207
MKCOL /webdav-www.boscom.com.preview.taglab.com/risk2/ HTTP/1.1
HTTP/1.1 201
PROPFIND /webdav-www.boscom.com.preview.taglab.com/risk2/character HTTP/1.1
HTTP/1.1 404
PROPFIND /webdav-www.boscom.com.preview.taglab.com/risk2/ HTTP/1.1
HTTP/1.1 404

The problem is the last PROPFIND fails despite the MKCOL for the same resource
succeeded. 

It all boils down to that doPropfind() always strips a trailing "/" of the path.
This means that "/risk2/" would be used as "/risk2". The lookup in the
DirContext is done using "/risk2" (resources.lookup()) and such the very first
"/risk2" propfind (before MKCOL) gets cached in the DirContext as not existing
(which is correct). However the MKCOL is done using "/risk2/" with the trailing
slash which means that the resources.createSubcontext() call does not clear the
DirContext cached entry for "/risk2", and such the second call to propfind for
"/risk2/" fails with a 404.

Here is one solution to this specific problem.

$ diff -u WebdavServlet.java-2003-07-01 WebdavServlet.java
--- WebdavServlet.java-2003-07-01       2003-07-01 11:37:34.000000000 +0100
+++ WebdavServlet.java  2003-07-02 15:10:30.000000000 +0100
@@ -692,6 +692,8 @@
         }
                                                                                
         String path = getRelativePath(req);
+        if (path.endsWith("/"))
+            path = path.substring(0, path.length() - 1);
                                                                                
         if ((path.toUpperCase().startsWith("/WEB-INF")) ||
             (path.toUpperCase().startsWith("/META-INF"))) {



I think that this needs to be solved on a more fundamental level. ALL methods in
the WebdavServlet should do the same processing of the path so that no
inconsistencies against the DirContext can occur. Perhaps getRelativePath()
could be overriden and _always_ strip any trailing slashes. I haven't tried this
out and I'm out of time in resolving this issue now.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to