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 Yong Hu <hu...@yahoo.com.cn> on 2004/08/24 12:05:49 UTC
question about WebdavResource.exists()
All,
Does anyone know how to use exists() method in org.apache.webdav.lib.WebdavResource?
In WebdavResource.java's comments, I find that exists() is similar to the exists() in java.io.File, so I think if i want to check if one file(such as files/test.txt) exists, i can do as following:
1. create a instance of WebdavResource;
2. call setPath(/rootpath/files/test.txt); (rootPath is the slide's root path)
3. call exists() to check if the files exists.
but if the file doesn't exists, HttpException will be thrown when calling setPath(), so I have no change to call exists().
Is my usage of exists() right? If not, how should i use it?
Thanks in advance.
regards
Yong
---------------------------------
Do You Yahoo!?
嫌邮箱太小?雅虎电邮自助扩容!
Re: question about WebdavResource.exists()
Posted by Ingo Brunberg <ib...@fiz-chemie.de>.
I would recommend not to use exists() at all. Whenever I want to check
the existence of a resource I simply use the HEAD method.
For the given example:
if (webdavResource.headMethod("/rootpath/files/test.txt") {
// test.txt exists
}
Regards,
Ingo
> All,
>
> Does anyone know how to use exists() method in org.apache.webdav.lib.WebdavResource?
>
>
> In WebdavResource.java's comments, I find that exists() is similar to the exists() in java.io.File, so I think if i want to check if one file(such as files/test.txt) exists, i can do as following:
>
> 1. create a instance of WebdavResource;
> 2. call setPath(/rootpath/files/test.txt); (rootPath is the slide's root path)
> 3. call exists() to check if the files exists.
>
> but if the file doesn't exists, HttpException will be thrown when calling setPath(), so I have no change to call exists().
>
> Is my usage of exists() right? If not, how should i use it?
>
> Thanks in advance.
>
> regards
> Yong
---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org