This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Servlets and the fly likes Doubt in HTTPServletResponse Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Doubt in HTTPServletResponse" Watch "Doubt in HTTPServletResponse" New topic
Author

Doubt in HTTPServletResponse

Thirugnanam Saravanan
Ranch Hand

Joined: Dec 13, 2007
Posts: 81
Hi All,

I have tried this code from Head First book ( Chapter 4 ) to implement the jar download functionality in servlets. The code is working fine, but while downloading the file,it is not getting downloaded as jar file( with .jar extension). Instead it is getting downloaded as a file with unknown filetype. What's wrong with this code? What should I do to implement my code in such a way that, when i download, it should be downloaded as a .jar file? Any Ideas?



[ November 18, 2008: Message edited by: Thirugnanam Saravanan ]

Saravanan
SCJP 5.0(98%), SCWCD 5.0 (100%), OCA
Amol Nayak
Ranch Hand

Joined: Oct 26, 2006
Posts: 218
Try adding this to the code before writing the response to output stream.



[ November 18, 2008: Message edited by: Amol Nayak ]
Thirugnanam Saravanan
Ranch Hand

Joined: Dec 13, 2007
Posts: 81
Now it is working fine as per my expectation. Thank you so much for the reply.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in HTTPServletResponse