![]() |
Fetch files over web server
Hi, I am just a newbie and I need to write some programs.
I have one directory and under that directory, I have 35 xml files in the Apache Web Server. The path for the directory is like //localhost:8081/dirxml/ And path for the xml files are like.. //localhost:8081/dirxml/mycontacts.xml //localhost:8081/dirxml/favourtieactor.xml //localhost:8081/dirxml/favouritesinger.xml .... .... .... and so on.... I would like to fetch them from my java program and then produce an xml file which is a combination of those xml files. So, how can I fetch those xml files from web server simultaneously? Is it ok if I use java.net.URL class. But what I found so far is it needs to give the exact URL path like //localhost:8081/dirxml/mycontacts.xml?? But I can't do it coz I don't want to give those xml file names and fetches. What I want to do is to fetch the files under that directory without knowing the file name. It is like to fetch all the files under that directory which ends with .xml How can I do this? And is there any reference for it. Thanks in advance. |
Re: Fetch files over web server
You can use next code to retrieve list of files:
Code:
try { |
Re: Fetch files over web server
there is no simple way to do that because this is not a real path for a file system so this will be some huge code because you want to parse an html resulted from specified url and get the resulted inline files,
but fortunately apache did that effort and make a package called ivr this have more utilities to do such that things, so, you can download the binary from this location: |
Re: Fetch files over web server
ht tp:/ /a nt. apa che. org /i v y/d o w n lo ad. cgi
and then use it as simple as: |
Re: Fetch files over web server
sorry for that cutting
Code:
package networkanddatabase; |
Re: Fetch files over web server
Good solution, thanks!
|
| All times are GMT +5.5. The time now is 12:45. |