List Info

Thread: How to test is a folder exists ?




How to test is a folder exists ?
user name
2006-03-21 15:42:24
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:lixin.chugmail.com] 
Sent: Monday, March 20, 2006 7:11 PM
To: Slide Users Mailing List; marco.ferrettifermasoft.com
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 <marco.ferrettifermasoft.com> 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:
slide-user-unsubscribejakarta.apache.org
> > For additional commands, e-mail:
slide-user-helpjakarta.apache.org
>
> 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: slide-user-unsubscribejakarta.apache.org
For additional commands, e-mail: slide-user-helpjakarta.apache.org

How to test is a folder exists ?
user name
2006-03-23 01:52:29
Hi Ray,

>>You can tell WebdavResource not to do the default
lookups,
How do I do this ? I went through the API but did not find
something
close to do this.

>>but you end up having other problems in that case.
Can I set to 'do not load property' before calling
setPath(), then set
to 'load property' before calling exists() ?

thanks
lixin


On 3/21/06, Ray Sprinkle <rsprinklevhainc.com> wrote:
> 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:lixin.chugmail.com]
> Sent: Monday, March 20, 2006 7:11 PM
> To: Slide Users Mailing List; marco.ferrettifermasoft.com
> 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 <marco.ferrettifermasoft.com> 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:
slide-user-unsubscribejakarta.apache.org
> > > For additional commands, e-mail:
slide-user-helpjakarta.apache.org
> >
> > 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: slide-user-unsubscribejakarta.apache.org
> For additional commands, e-mail: slide-user-helpjakarta.apache.org
>
>

------------------------------------------------------------
---------
To unsubscribe, e-mail: slide-user-unsubscribejakarta.apache.org
For additional commands, e-mail: slide-user-helpjakarta.apache.org

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )