List Info

Thread: How to test is a folder exists ?




How to test is a folder exists ?
user name
2006-03-19 08:24:30
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

How to test is a folder exists ?
user name
2006-03-19 11:19:35
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.
How to test is a folder exists ?
user name
2006-03-19 11:18:59
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.
How to test is a folder exists ?
user name
2006-03-21 00:11:00
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.
>
>
>
[1-4]

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