By default a WebdavResource loads a set of properties from the server
when it is created or the path is changed.  I believe you are having
problems with this behaviour.  You can tell WebdavResource not to do the
default lookups, but you end up having other problems in that case.
Many/most of the properties of WebdavResource are set behind the scenes
using these default property lookups, including exists().
WebdavResource will not dynamically load the needed properties to
calculate things, but instead depends on the properties being loaded
ahead of time.  If you don't load the properties you get invalid
answers. 

-----Original Message-----
From: Lixin Chu [mailto:[EMAIL PROTECTED] 
Sent: Monday, March 20, 2006 7:11 PM
To: Slide Users Mailing List; [EMAIL PROTECTED]
Subject: Re: How to test is a folder exists ?

Hi,
I forgot to put this but the problem is that setPath() throws
HttpException already the folder does not exist.

rgds
lixin

On 3/19/06, Marco Ferretti <[EMAIL PROTECTED]> wrote:
>
> On Sunday 19 March 2006 09:24, Lixin Chu wrote:
> > How to test is a folder exists ?
> >
> > I try to use webdavResource.setPath (path) and then
> webdavResource.exists()
> >
> > but setPath throws HttpException with reason code 404. is this the 
> > only way to  know if a folder does not exit:
> >
> >   try {
> >          webdavResource.setPath (path);
> >   } catch (HttpException he) {
> >          if (he.getReasonCode() == 404) {
> >             // create the folde here ...
> >          }
> >   }
> >
> > thanks !
> > lx
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> you forgot to query the exists() method of WebdavResource ;
>
> so your code shall look like :
>
>
>           webdavResource.setPath (path);
>           if (webdavResource.exists()){
>                 // do something
>           } else {
>                 // do something else
>           }
>
>
> cheers
>
> Marco
> --
> A Tale of Two Cities LITE(tm)
>         -- by Charles Dickens
>
>         A man in love with a girl who loves another man who looks just
>         like him has his head chopped off in France because of a mean
>         lady who knits.
>
> Crime and Punishment LITE(tm)
>         -- by Fyodor Dostoevski
>
>         A man sends a nasty letter to a pawnbroker, but later
>         feels guilty and apologizes.
>
> The Odyssey LITE(tm)
>         -- by Homer
>
>         After working late, a valiant warrior gets lost on his way
home.
>
>
>


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

Reply via email to