This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes ftp or http or what? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "ftp or http or what?" Watch "ftp or http or what?" New topic
Author

ftp or http or what?

Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
I'm trying to figure out which technology to use. Here's what I need to do:
Currently, my boss goes to a website that displays a login form, and eventually he clicks his way to a listing of URLs to data files that need to be downloaded. This other company posting the information uses servlets to retrieve the data and construct these files dynamically (as far as I can tell). We're going to get much more data in, so I need to automate this process.
I initially assumed I would need to try to open an FTP connection to their site in Java, so I was looking at the Apache Commons Net package. I assume that then I'd have to post the initial forms (login, etc) in Java, and then parse the listing page to find the live URLs to the files. However, I don't want to do this (e.g. learn the Apache Commons Net API) if there's a simpler way. For instance, should I be able to use classes like HttpURLConnection in the java.net API to do all of my interaction with their site? All I know is that when I access their site, it's an https connection. If it's not as easy to use stuff that Sun provides, then by all means I'll try to do it with the Apache package.
Jerry Kreps gave me some advice in another post, but I don't want to start coding with that if my approach is not right!
Thanks for any advice,
Stephen
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
HTTPS with URL is as simple as the lines marked as added a year ago:

You'll probably have to POST a form to log in. I haven't had great luck with sending POST data through URL. My last try in a JUnit test seemed to be sending everything twice. This was straight from a tutorial someplace on the web.

Hope some of that helps.
[ August 07, 2003: Message edited by: Stan James ]

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ftp or http or what?
 
Similar Threads
file upload
ftp or some other protocol?
need to send ftp explicit command using Apache Commons Net classes
How to Check whether the file in the Ftpserver is a directory or not?
commons net 1.4.1 - sendSiteCommand