Bug 28079 - Problems if WebdavServlet is not mapped to "/"
Summary: Problems if WebdavServlet is not mapped to "/"
Status: RESOLVED FIXED
Alias: None
Product: Slide
Classification: Unclassified
Component: WebDAV Server (show other bugs)
Version: 2.0
Hardware: All All
: P3 normal (vote)
Target Milestone: ---
Assignee: Slide Developer List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-31 08:34 UTC by Stefan L
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan L 2004-03-31 08:34:36 UTC
As stated in a mail there are some problems if the WebdavServlet is not mapped
to be the default servlet of a web application.

The problem occurs because often context path and the servlet path are
not considerd both.

Some of the problems can be fixed with the patch below. The functional 
test cases are running now in both configs (as default and as non default
servlet) with the exception of the SEARCH method. 

With SEARCH there is a problem that not enough information is passed
in to evaluate the correct slide-context (i.e. context + servlet path).

TODO remains the other testcases at which I'm willing to work on, if 
there is no one who works currently on this issue.

Index: src/webdav/server/org/apache/slide/webdav/WebdavServlet.java
===================================================================
retrieving revision 1.54.2.2
diff -u -r1.54.2.2 WebdavServlet.java
--- src/webdav/server/org/apache/slide/webdav/WebdavServlet.java	29 Mar 2004
14:45:51 -0000	1.54.2.2
+++ src/webdav/server/org/apache/slide/webdav/WebdavServlet.java	30 Mar 2004
13:11:18 -0000
@@ -131,6 +131,9 @@
         SimpleDateFormat sdf = new SimpleDateFormat();
         if( token.getLogger().isEnabled(LOG_CHANNEL, Logger.DEBUG) )
             token.getLogger().log("==> "+req.getMethod()+" start:
"+sdf.format(new Date(System.currentTimeMillis()))+"
["+Thread.currentThread().getName()+"]", LOG_CHANNEL, Logger.DEBUG);
+
+        req.setAttribute("slide_uri", WebdavUtils.getRelativePath(req, 
+                                     (WebdavServletConfig)getServletConfig()));
         
         try {
             
@@ -337,9 +340,6 @@
                                  token.getName());
                 // attributes for general use
                 req.setAttribute("slide_namespace", token.getName());
-                req.setAttribute
-                    ("slide_uri", WebdavUtils.getRelativePath
-                         (req, (WebdavServletConfig)getServletConfig()));
                 directoryBrowsingTemplate.forward(req, res);
             } else {
                 try {
Index: src/webdav/server/org/apache/slide/webdav/filter/LogFilter.java
===================================================================
retrieving revision 1.6.2.1
diff -u -r1.6.2.1 LogFilter.java
--- src/webdav/server/org/apache/slide/webdav/filter/LogFilter.java	5 Feb 2004
16:11:22 -0000	1.6.2.1
+++ src/webdav/server/org/apache/slide/webdav/filter/LogFilter.java	30 Mar 2004
13:11:18 -0000
@@ -129,9 +129,6 @@
         String datetime = df.format( new Date() );
         String method = req.getMethod();
         String uri = req.getRequestURI();
-        String path = req.getServletPath();
-        if( "".equals(path) )
-            path = "/";
         Principal p = req.getUserPrincipal();
         String principal = (p != null ? p.getName() : "");
         String contentlength = req.getHeader( "Content-Length" );
@@ -147,7 +144,9 @@
         String detail = resp.getStatusText();
         if( detail == null || "".equals(detail) )
             detail = message;
-
+        String path = (String)req.getAttribute("slide_uri"); // set by
WebdavServlet
+        if( path == null ) path = "?"; 
+        if( "".equals(path) ) path = "/";
 
         long end = System.currentTimeMillis();
         logLine( (end-start), status, thread, method, datetime, uri, path,
contentlength, principal,
Index: src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java
===================================================================
retrieving revision 1.20.2.2
diff -u -r1.20.2.2 AbstractWebdavMethod.java
--- src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java
23 Mar 2004 13:32:08 -0000	1.20.2.2
+++ src/webdav/server/org/apache/slide/webdav/method/AbstractWebdavMethod.java
30 Mar 2004 13:11:20 -0000
@@ -370,15 +370,11 @@
 
 
     /**
-     * Return an absolute URL (absolute in the HTTP sense) based on a Slide
+     * Return an absolute path (absolute in the HTTP sense) based on a Slide
      * path.
      */
-    public String getFullPath(String path) {
-
-        if (path.startsWith("/"))
-            return WebdavUtils.encodeURL(req.getContextPath() + path);
-        else
-            return WebdavUtils.encodeURL(req.getContextPath() + "/" + path);
+    public String getFullPath(String slidePath) {
+       return WebdavUtils.getAbsolutePath(slidePath, req, getConfig());
     }
 
 
Index: src/webdav/server/org/apache/slide/webdav/util/PropertyRetrieverImpl.java
===================================================================
retrieving revision 1.31.2.2
diff -u -r1.31.2.2 PropertyRetrieverImpl.java
--- src/webdav/server/org/apache/slide/webdav/util/PropertyRetrieverImpl.java	14
Mar 2004 18:14:56 -0000	1.31.2.2
+++ src/webdav/server/org/apache/slide/webdav/util/PropertyRetrieverImpl.java	30
Mar 2004 13:11:22 -0000
@@ -578,9 +578,9 @@
             if( propertyValue.toString().indexOf('<') >= 0 ) {
                 try {
                     XMLValue xmlValue = new XMLValue(propertyValue.toString(),
valueDefaultNamespace);
-                    if (AbstractResourceKind.isLiveProperty(propertyName)) {
-                        convertHrefValueToAbsoluteURL (xmlValue, contextPath,
servletPath, config);
-                    }
+//                    if (AbstractResourceKind.isLiveProperty(propertyName)) {
+//                        convertHrefValueToAbsoluteURL (xmlValue, contextPath,
servletPath, config);
+//                    }
                     Iterator iterator = xmlValue.iterator();
                     while (iterator.hasNext()) {
                         Object o = iterator.next();
Comment 1 Robert Flaherty 2004-04-01 07:34:17 UTC
I've trapped input and output and have seen similar problems.  The full dump 
is included, but the problems I see are:

1) Some servlet paths being written out as null
<D:principal-collection-set>
    <D:href>/hab-samplesnull/users</D:href>
    <D:href>/hab-samplesnull</D:href>
    <D:href>/hab-samplesnull/roles</D:href>
</D:principal-collection-set>

2)Some servlet paths being written out with the server URL
<D:inherited>
    <D:href>/hab-sampleshttp%3A//localhost%3A8080/files</D:href>
</D:inherited>
<D:principal>
    <D:href>/hab-sampleshttp%3A//localhost%3A8080/roles/HAB_User</D:href>
</D:principal>

Searching the code I think that the calls to WebdavUtils.getAbsolutePath() in 
AbstractReport, PrincipalMatchReport, PrincipalPropertySearchReport, 
PropertyHelper and PropertyRetrieverImpl should be passing in servlet path not 
the server URL.

_______________________________________________________________________________
|Request http://localhost:8080/hab-samples/WAAWebdavServlet/files (Thread
[http8080-Processor4,5,main])
|
|Authorization Type: BASIC
|Character Encoding:
|Content: <in the response>
|Content Length: 0
|Content Type: text/xml
|Context Path: /hab-samples
|Cookies [0]: Comment=null, Domain=null, Max Age=-1, Name=JSESSIONID, 
Path=null, Secure=false, Value=92D79077DE40DAB4DF0972364F6C8B0B, Version=0
|Header [content-language]: en-us
|Header [accept-language]: en-us
|Header [content-type]: text/xml
|Header [translate]: f
|Header [depth]: 0
|Header [content-length]: 0
|Header [user-agent]: Microsoft Data Access Internet Publishing Provider DAV
|Header [host]: localhost:8080
|Header [connection]: Keep-Alive
|Header [cookie]: JSESSIONID=92D79077DE40DAB4DF0972364F6C8B0B
|Header [authorization]: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==
|Locale: en_US
|Locale [0]: en_US
|Method: PROPFIND
|Path Info: /files
|Path Translated: C:\Tools\jakarta-tomcat-4.1.30\webapps\hab-samples\files
|Protocol: HTTP/1.1
|Query String:
|Remote Address: 127.0.0.1
|Remote Host: localhost
|Remote User: Administrator
|Request URI: /hab-samples/WAAWebdavServlet/files
|Requested Session Id: 92D79077DE40DAB4DF0972364F6C8B0B
|Requested Session Id From Cookie: true
|Requested Session Id From URL: false
|Requested Session Id Valid: true
|Scheme: http
|Secure: false
|Server Name: localhost
|Server Port: 8080
|Servlet Path: /WAAWebdavServlet
|______________________________________________________________________________
_

 
_______________________________________________________________________________
|Response http://localhost:8080/hab-samples/WAAWebdavServlet/files (Thread
[http8080-Processor4,5,main])
|
|Buffer Size: 8192
|Character Encoding: UTF-8
|Committed: true
|Header [Content-Length]: -1
|Header [Content-Type]: text/xml; charset="UTF-8"
|Locale: en_US
|Redirect Location:
|Status: 207-Multi-Status
|Status Message:
|Request Content:
|Content:
|       <?xml version="1.0" encoding="UTF-8"?>
|       <D:multistatus xmlns:D="DAV:">
|           <D:response>
|               <D:href>/hab-samples/WAAWebdavServlet/files</D:href>
|               <D:propstat>
|                   <D:prop>
|                       <D:modificationuser>
|                           <D:href>/hab-samples/users/unauthenticated</D:href>
|                       </D:modificationuser>
|                       <D:inherited-acl-set />
|                       <D:owner>
|                           <D:unauthenticated />
|                       </D:owner>
|                       <D:supported-privilege-set>
|                           <D:supported-privilege>
|                               <D:privilege>
|                                   <D:all />
|                               </D:privilege>
|                               <D:supported-privilege>
|                                   <D:privilege>
|                                       <D:write />
|                                   </D:privilege>
|                                   <D:supported-privilege>
|                                       <D:privilege>
|                                           <D:write-content />
|                                       </D:privilege>
|                                       <D:supported-privilege>
|                                           <D:privilege>
|                                               <D:unbind />
|                                           </D:privilege>
|                                       </D:supported-privilege>
|                                       <D:supported-privilege>
|                                           <D:privilege>
|                                               <D:bind />
|                                           </D:privilege>
|                                       </D:supported-privilege>
|                                   </D:supported-privilege>
|                                   <D:supported-privilege>
|                                       <D:privilege>
|                                           <D:write-acl />
|                                       </D:privilege>
|                                   </D:supported-privilege>
|                                   <D:supported-privilege>
|                                       <D:privilege>
|                                           <D:write-properties />
|                                       </D:privilege>
|                                   </D:supported-privilege>
|                               </D:supported-privilege>
|                               <D:supported-privilege>
|                                   <D:privilege>
|                                       <D:unlock />
|                                   </D:privilege>
|                               </D:supported-privilege>
|                               <D:supported-privilege>
|                                   <D:privilege>
|                                       <D:read />
|                                   </D:privilege>
|                                   <D:supported-privilege>
|                                       <D:privilege>
|                                           <D:read-current-user-privilege-
set />
|                                       </D:privilege>
|                                   </D:supported-privilege>
|                                   <D:supported-privilege>
|                                       <D:privilege>
|                                           <D:read-acl />
|                                       </D:privilege>
|                                   </D:supported-privilege>
|                               </D:supported-privilege>
|                           </D:supported-privilege>
|                       </D:supported-privilege-set>
|                       <D:acl-restrictions />
|                       <D:displayname>files</D:displayname>
|                       <D:creationdate>2004-03-31T23:14:48Z</D:creationdate>
|                       <D:source />
|                       <D:principal-collection-set>
|                           <D:href>/hab-samplesnull/users</D:href>
|                           <D:href>/hab-samplesnull</D:href>
|                           <D:href>/hab-samplesnull/roles</D:href>
|                       </D:principal-collection-set>
|                       <D:privilege-collection-set>
|                           <D:href>/hab-samplesnull/actions</D:href>
|                       </D:privilege-collection-set>
|                       <D:supported-report-set>
|                           <D:supported-report>
|                               <D:report>
|                                   <D:expand-property />
|                               </D:report>
|                           </D:supported-report>
|                       </D:supported-report-set>
|                       <D:lockdiscovery />
|                       <D:acl>
|                           <D:ace>
|                               <D:principal>
|                                   <D:unauthenticated />
|                               </D:principal>
|                               <D:grant>
|                                   <D:privilege>
|                                       <D:all />
|                                   </D:privilege>
|                               </D:grant>
|                               <D:inherited>
|                                   <D:href>/hab-sampleshttp%3A//localhost%
3A8080/files</D:href>
|                               </D:inherited>
|                           </D:ace>
|                           <D:ace>
|                               <D:principal>
|                                   <D:href>/hab-sampleshttp%3A//localhost%
3A8080/roles/HAB_User</D:href>
|                               </D:principal>
|                               <D:grant>
|                                   <D:privilege>
|                                       <D:write />
|                                   </D:privilege>
|                               </D:grant>
|                               <D:inherited>
|                                   <D:href>/hab-sampleshttp%3A//localhost%
3A8080/files</D:href>
|                               </D:inherited>
|                           </D:ace>
|                           <D:ace>
|                               <D:principal>
|                                   <D:property>
|                                       <D:owner />
|                                   </D:property>
|                               </D:principal>
|                               <D:grant>
|                                   <D:privilege>
|                                       <D:read-acl />
|                                   </D:privilege>
|                               </D:grant>
|                               <D:inherited>
|                                   <D:href>/hab-sampleshttp%3A//localhost%
3A8080/files</D:href>
|                               </D:inherited>
|                           </D:ace>
|                           <D:ace>
|                               <D:principal>
|                                   <D:href>/hab-sampleshttp%3A//localhost%
3A8080/roles/HAB_Admin</D:href>
|                               </D:principal>
|                               <D:grant>
|                                   <D:privilege>
|                                       <D:all />
|                                   </D:privilege>
|                               </D:grant>
|                               <D:inherited>
|                                   <D:href>/hab-sampleshttp%3A//localhost%
3A8080/</D:href>
|                               </D:inherited>
|                           </D:ace>
|                           <D:ace>
|                               <D:principal>
|                                   <D:all />
|                               </D:principal>
|                               <D:deny>
|                                   <D:privilege>
|                                       <D:read-acl />
|                                   </D:privilege>
|                                   <D:privilege>
|                                       <D:write-acl />
|                                   </D:privilege>
|                                   <D:privilege>
|                                       <D:unlock />
|                                   </D:privilege>
|                               </D:deny>
|                               <D:inherited>
|                                   <D:href>/hab-sampleshttp%3A//localhost%
3A8080/</D:href>
|                               </D:inherited>
|                           </D:ace>
|                           <D:ace>
|                               <D:principal>
|                                   <D:all />
|                               </D:principal>
|                               <D:grant>
|                                   <D:privilege>
|                                       <D:read />
|                                   </D:privilege>
|                               </D:grant>
|                               <D:inherited>
|                                   <D:href>/hab-sampleshttp%3A//localhost%
3A8080/</D:href>
|                               </D:inherited>
|                           </D:ace>
|                           <D:ace>
|                               <D:principal>
|                                   <D:href>/hab-sampleshttp%3A//localhost%
3A8080/roles/HAB_User</D:href>
|                               </D:principal>
|                               <D:grant>
|                                   <D:privilege>
|                                       <D:write-properties />
|                                   </D:privilege>
|                               </D:grant>
|                               <D:inherited>
|                                   <D:href>/hab-sampleshttp%3A//localhost%
3A8080/</D:href>
|                               </D:inherited>
|                           </D:ace>
|                       </D:acl>
|                       <D:supported-live-property-set>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:comment />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:displayname />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:acl />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:resourcetype />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:creationuser />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:supported-report-set />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:creator-displayname />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:principal-collection-set />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:inherited-acl-set />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:getcontentlength />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:supported-method-set />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:current-user-privilege-set />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:modificationdate />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:supported-privilege-set />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:getcontentlanguage />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:getetag />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:lockdiscovery />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:owner />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:modificationuser />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:getlastmodified />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:privilege-collection-set />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:workspace />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:acl-restrictions />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:supportedlock />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:getcontenttype />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:source />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:supported-live-property-set />
|                               </D:prop>
|                           </D:supported-live-property>
|                           <D:supported-live-property>
|                               <D:prop>
|                                   <D:creationdate />
|                               </D:prop>
|                           </D:supported-live-property>
|                       </D:supported-live-property-set>
|                       <D:supportedlock>
|                           <D:lockentry>
|                               <D:lockscope>
|                                   <D:exclusive />
|                               </D:lockscope>
|                               <D:locktype>
|                                   <D:write />
|                               </D:locktype>
|                           </D:lockentry>
|                           <D:lockentry>
|                               <D:lockscope>
|                                   <D:shared />
|                               </D:lockscope>
|                               <D:locktype>
|                                   <D:write />
|                               </D:locktype>
|                           </D:lockentry>
|                       </D:supportedlock>
|                       <D:getlastmodified>Wed, 31 Mar 2004 23:14:48 
GMT</D:getlastmodified>
|                       <D:modificationdate>2004-04-
01T06:55:05Z</D:modificationdate>
|                       <D:getcontentlength>0</D:getcontentlength>
|                       <D:current-user-privilege-set>
|                           <D:privilege>
|                               <D:read />
|                           </D:privilege>
|                           <D:privilege>
|                               <D:read-acl />
|                           </D:privilege>
|                           <D:privilege>
|                               <D:read-current-user-privilege-set />
|                           </D:privilege>
|                           <D:privilege>
|                               <D:write />
|                           </D:privilege>
|                           <D:privilege>
|                               <D:write-acl />
|                           </D:privilege>
|                           <D:privilege>
|                               <D:write-properties />
|                           </D:privilege>
|                           <D:privilege>
|                               <D:write-content />
|                           </D:privilege>
|                           <D:privilege>
|                               <D:bind />
|                           </D:privilege>
|                           <D:privilege>
|                               <D:unbind />
|                           </D:privilege>
|                           <D:privilege>
|                               <D:unlock />
|                           </D:privilege>
|                       </D:current-user-privilege-set>
|                       <D:creationuser>
|                           <D:unauthenticated />
|                       </D:creationuser>
|                       <D:resourcetype>
|                           <D:collection />
|                       </D:resourcetype>
|                       <D:supported-method-set>
|                           <D:supported-method name="PROPPATCH" />
|                           <D:supported-method name="COPY" />
|                           <D:supported-method name="DELETE" />
|                           <D:supported-method name="POST" />
|                           <D:supported-method name="GET" />
|                           <D:supported-method name="REPORT" />
|                           <D:supported-method name="PROPFIND" />
|                           <D:supported-method name="PUT" />
|                           <D:supported-method name="MOVE" />
|                           <D:supported-method name="UNLOCK" />
|                           <D:supported-method name="TRACE" />
|                           <D:supported-method name="OPTIONS" />
|                           <D:supported-method name="HEAD" />
|                           <D:supported-method name="ACL" />
|                           <D:supported-method name="LOCK" />
|                           <D:supported-method name="CONNECT" />
|                           <D:supported-method name="SEARCH" />
|                       </D:supported-method-set>
|                   </D:prop>
|                   <D:status>HTTP/1.1 200 OK</D:status>
|               </D:propstat>
|               <D:propstat>
|                   <D:prop>
|                       <D:workspace />
|                   </D:prop>
|                   <D:status>HTTP/1.1 404 Not Found</D:status>
|               </D:propstat>
|           </D:response>
|       </D:multistatus>
|______________________________________________________________________________
_
Comment 2 Robert Flaherty 2004-04-01 07:40:01 UTC
Actually, I just found the null problems.  Some of the calls to 
WebdavUtils.getAbsolutePath() in PropertyHelper are passing null for the 
servlet path.
Comment 3 Oliver Zeigermann 2004-04-01 13:47:31 UTC
Applied patch. Thanks for the patch, but next time please create an attachment
as lines get wrapped when copied into comment.