I suspect WebdavResource was designed to be used the way it is used in the slide command line client and that's it. Some functions like exists() may have been added just for completeness trying to parallel the File API but as you point out, it makes no sense to have a exists() function if you can't create a WebdavResource on a non-existent resource. Same goes for the mkcolMethod and putMethod's without arguments. The way I'm using it, basically, is to work with the parent WebdavResource of the resource I'm interested in and use the putMethod or other methods that take a relative path as argument. Working on the parent resource I know its children so I know if a resource exists or not before operating on it. In my case, working this way is fine because I need to keep track of the resource hierarchy for other purposes, so my parent resource and children are already available!
For "intended" usage patterns check the slide command line sample client. Other ways of using WebdavResource outside of what the command line client does, were probably not thought of carefully or haven't been tested.


Carlos

Garret Wilson wrote:
James,

James Mason wrote:

After you construct your WebdavResource you should be able to call
headMethod() to see if the remote resource exists. I don't know if this
is the best method, but it should work.


There are a 100 ways that would work, I'm sure---but how was WebdavResource *designed* to be used?

Why doesn't WebdavResource call headMethod() itself when I check its existence? Why does it try to gather properties when I create a WebdavResource instance? If it for some reason *has* to do a PROPFIND, why doesn't it determine the nonexistence and just set the existence flag to false?

As I mentioned to someone off the list: Imagine if creating a java.io.File for a non-existent file threw an IOException, and you had to try to open up an InputStream using low-level disk I/O just to see if you could create a java.io.File. (You could always create a java.io.File(boolean dontcheckdisk), but this would return incorrect information for java.io.File.exists().

Garret

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




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



Reply via email to