• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Problem with Jar download code in servlet

 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Thirugnanam Saravanan:
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?



set the "content-disposition" header, like this:



just replace that with the filename and you're set.
 
Thirugnanam Saravanan
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks . Now it works
 
Ranch Hand
Posts: 423
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Can you please let me know why do we need [B] and [/B> here
 
Creator of Enthuware JWS+ V6
Posts: 3346
303
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi, Can you please let me know why do we need [B] and [/B> here


That is a small mistake: they don't need to be there

Regards,
Frits
 
Can you hear that? That's my theme music. I don't know where it comes from. Check under this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic