aspose file tools*
The moose likes Servlets and the fly likes send file from java app works in browser but not wget or curl? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "send file from java app works in browser but not wget or curl?" Watch "send file from java app works in browser but not wget or curl?" New topic
Author

send file from java app works in browser but not wget or curl?

Jay Park
Greenhorn

Joined: Sep 10, 2009
Posts: 3
Hi,

I have some code that downloads a binary file just fine when executed from a broswer, but when I run the app via wget or curl, everything works fine except that I never get the file. Any ideas why that might be? It's a spring application. Here's the section of the code that delivers the file:




Thanks for any help you can offer
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Please be sure to use code tags (not blue text) when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Does wget or curl handle attachments? What happens if you send the data directly?
Jay Park
Greenhorn

Joined: Sep 10, 2009
Posts: 3
If I change
response.setHeader("Content-Disposition", ("attachment; filename=" + shortfilename));

to

response.setHeader("Content-Disposition", ("inline"));

The file still does not appear using wget (although we still get a file from the browser.)
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What if you don't set it at all?
Jay Park
Greenhorn

Joined: Sep 10, 2009
Posts: 3
Thanks, that makes it work with curl, but not wget - ok for what we need!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: send file from java app works in browser but not wget or curl?