• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Jay Park
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does wget or curl handle attachments? What happens if you send the data directly?
 
Jay Park
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if you don't set it at all?
 
Jay Park
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that makes it work with curl, but not wget - ok for what we need!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic