Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Response different from IE to Netscape

 
David Li
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the HttpServletResponse to send either PDF or xls file to the user. It is working fine in Netscape. However, in IE, the browser will display error on opening the file when traffic is heavy on the site. Why is that?
The server is Websphere.
 
David Hibbs
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by David Li:
Using the HttpServletResponse to send either PDF or xls file to the user. It is working fine in Netscape. However, in IE, the browser will display error on opening the file when traffic is heavy on the site. Why is that?
The server is Websphere.

Question #1: Does this *only* happen during heavy traffic? If so, maybe it's how you are sending the file. Which leads to...
Question #2: How exactly are you sending the file--writing direct to the response? Forward? Redirect? Maybe you need to specify the mime content type mapping in your application config.
Suggestion:
Post a more thorough description of your problem in the WebSphere forum...
http://www.coderanch.com/forums/f-46/Websphere
 
David Li
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David, did what you suggested but got no response yet. Could you please be more specific on "Maybe you need to specify the mime content type mapping in your application config."? Thanks.
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The mime type is what you set for the response when you call response.setContentType. Are you setting it to "application/pdf"?
 
David Li
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes. here is the code:
ServletOutputStream outStream = null;
try {
if (fileType.equals("xls"))
response.setContentType("application/vnd.ms-excel");
else if (fileType.equals("pdf"))
response.setContentType("application/pdf");
response.setContentLength(report.length);
outStream = response.getOutputStream();
outStream.write(report);
} catch (Exception e4) {
System.out.println("Can not output"+e4.getMessage());
}
finally {
if (outStream != null) {
try {outStream.close();}catch(Exception e5){}
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic