[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-users
Subject:    Re: list the directory before call the get method
From:       Julius Davies <juliusdavies () cucbc ! com>
Date:       2006-06-12 20:23:55
Message-ID: 1150143835.4921.75.camel () apple ! ca
[Download RAW message or body]

Hi, Fatiha,

You can try calling "GET /path/to/directory/" and parsing the HTML or
XHTML results of that - assuming "directory listings" are enabled.  Most
web servers have that turned off.

Many web servers probably return HTML 3.2, which XML parsers hate, so
good luck!

Assuming that works, you can then follow it up with
"GET /path/to/directory/the_file_I_like" 

But you are depending on your webserver serving directory listings in a
consistent fashion.  Tomcat does directory listings one way, IIS
another, and Apache has his way.

If you are trying to determine file size or last modified datestamp
through this, I would recommend using
"HEAD /path/to/directory/the_file_I_like" instead.

But if you are trying to discover new files that you didn't know about
before, then this (or webcrawling) is the only option I know of.

Unless you can open up FTP to the same directory?


yours,

Julius

http://juliusdavies.ca/



On Mon, 2006-12-06 at 20:58 +0200, Rafał Krupiński wrote:
> on Mon, 12 Jun 2006 11:16:08 +0200 Fatiha Lokmane <flokmane@iratensolutions.com>
> wrote:
> 
> > Hi,
> > Is it possible to know the content of directory with HTTPClient before 
> > call the GET method?
> 
> Of course. You can call POST method with empty data contents.
> But remember, listing directories works only on servers that support and allow
> this.
> 
> Best regards
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
-- 
Julius Davies
Senior Application Developer, Technology Services
Credit Union Central of British Columbia
http://www.cucbc.com/
Tel: 604-730-6385
Cel: 604-868-7571
Fax: 604-737-5910

1441 Creekside Drive
Vancouver, BC
Canada
V6J 4S7

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic