• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IE Hangs when I use servlet to download a file

 
Mrutyunjay Hanchinal
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am downloading a HTML file by using servlet.
I have used following code
=================================================
res.setContentType("text/html");
res.setHeader("Content-disposition","attachment; filename" +"m.html" );
PrintWriter out=res.getWriter();
try
{
out.println"<html><head></head><body><h1>Mrutyunjay</h1></body></html>");
out.close();
}
catch(Exception e)
{
System.out.println("exception "+e);
e.printStackTrace();
}
=================================================
I am using IE. When ever I request for download It opens the download confirmation box and gives two options in windows
1. Open from current location
2. Save to disk
If I choose Save to disk it is working fine. If I choose open from current location then the IE hangs.
This works fine in Netscape.
Any answers for this?
Thanks
Mrutyunjay
[ March 05, 2002: Message edited by: Mrutyunjay Hanchinal ]
 
Tim Holloway
Saloon Keeper
Posts: 18300
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Some versions of IE have known bugs regarding the Content-disposition header
 
Christopher Dixon
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a shot in the dark, but have you tried to set the content-length header to the number of bytes in your output? For a simple test, you could manually count, but for more complex output, write to a ByteArrayOutputStream. Just a guess...
Chris
 
Mrutyunjay Hanchinal
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI
I think what Tim says is right.
I upgraded IE from 5.00 to 5.50 and the problem is solved
Thanks for the answers
Mrutyunjay
 
Mrutyunjay Hanchinal
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
With respect to my above download problem, Can I disable "open this file from its current location" option in dialog box?
since I don't need that open in current location option.
I have seen in one of the site this being disabled.
I will be thankful for any Help
Regards
Mrutyunjay
[ March 06, 2002: Message edited by: Mrutyunjay Hanchinal ]
[ March 06, 2002: Message edited by: Mrutyunjay Hanchinal ]
 
Tim Holloway
Saloon Keeper
Posts: 18300
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the Microsoft online docs (MSDN) concerning their version of Content-Disposition. This is an IE-specific issue (more or less - I think other browsers have stolen it now). I believe they have added extensions to the standard Content-Disposition and one of them might do what you want.
 
Mrutyunjay Hanchinal
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Tim
If you could tell me what is the extension or the resource on the web which shows me how to disable the "Open this file from its current location" radio button in the download box which appears on downloading some file, It would be very helpful to me
Waiting fro your response
Thanks in advance
Mrutyunjay
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic