I've been trying to figure this out since monday, searching through bunches of google groups and what not.. without finding answers. See if you guys have any idea of what's causing this to fail so miserably.
I am trying to programmatically download a file from a website. The way it works manually is as follows:
The dialog box pops up because the server's response header has Content-Disposition set to attachment. This way the file is not stored in the message body, but in the attachment. Here are the server's response headers: Server: HTTPD/1.0.0 Content-Disposition: attachment; filename=myfile.000 Content-Length: 0 Vary: Accept-Encoding,User-Agent Content-Type: application/x-force-download
Commons' HttpClient, provides methods to read the message body, headers and footers, however I could not figure out whether the attachment is stored in either of the three, or whether I need to look for another API (suggestions welcomed!) to get that file in from an application.
I figured it out. It was my own problem, the site that I had to connect to and download files from had a bunch of hidden fields, which were necessary for successful connection. I got to know about only after wasting couple of days trying to figure out whats wrong with GET, when all I needed was a POST with a bunch of parameters hidden on the form.
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop