You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by Max Muller <ma...@mac.com> on 2004/12/10 18:48:54 UTC

Constructing a WebdavResource for a resource that doesn't exist throws

Hola,
	I hope this isn't a redundant post, I have searched through some of  
the back archives but I haven't come across an answer.

Essentially this is the bit of code that I'm trying to get to run:

         HttpURL rootUrl = new HttpURL(uploadServerURL + "/" +  
providerFolderName);
         rootUrl.setUserinfo(userName, password);
         WebdavResource providerDirectory = new WebdavResource(rootUrl);

         if (!providerDirectory.exists()) {
             log.info("Provider directory: " + providerFolderName + "  
does not exist, creating.");
             providerDirectory.mkcolMethod();
         }

However the constructor of the WebdavResource throws an HttpException  
with status code 404. The 404 bit makes sense because the first time  
this bit of code runs the directory hasn't been created yet. I have  
verified this with both the 2.0 and 2.1RC1 versions of the WebDAV  
client. Constructing the WebdavResource for just the rootUrl works just  
fine in the above example. Any pointers on what I must be doing wrong  
would be greatly appreciated. Thanks!

Regards,
	Max

Stack dump from the 2.1RC1:

         at  
org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java: 
3467)
         at  
org.apache.webdav.lib.WebdavResource.propfindMethod(WebdavResource.java: 
3423)
         at  
org.apache.webdav.lib.WebdavResource.setNamedProp(WebdavResource.java: 
967)
         at  
org.apache.webdav.lib.WebdavResource.setBasicProperties(WebdavResource.j 
ava:912)
         at  
org.apache.webdav.lib.WebdavResource.setProperties(WebdavResource.java: 
1894)
         at  
org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java: 
1301)
         at  
org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java: 
1320)
         at  
org.apache.webdav.lib.WebdavResource.setHttpURL(WebdavResource.java: 
1408)
         at  
org.apache.webdav.lib.WebdavResource.<init>(WebdavResource.java:290)