aspose file tools*
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


Win a copy of Java 8 in Action this week in the Java 8 forum!
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
 
Similar Threads
problem running the download JAR application
code for file download
File name and extension
download file using OutputStream from Servlets
Problem with Jar download code in servlet