hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Julius Davies <juliusdav...@cucbc.com>
Subject Re: list the directory before call the get method
Date Mon, 12 Jun 2006 20:23:55 GMT
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


Mime
View raw message