Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes Servlet Response different from IE to Netscape Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Response different from IE to Netscape" Watch "Servlet Response different from IE to Netscape" New topic
Author

Servlet Response different from IE to Netscape

David Li
Greenhorn

Joined: Nov 23, 2000
Posts: 16
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

Joined: Dec 19, 2002
Posts: 374
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


"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
David Li
Greenhorn

Joined: Nov 23, 2000
Posts: 16
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

Joined: Mar 09, 2001
Posts: 2676
The mime type is what you set for the response when you call response.setContentType. Are you setting it to "application/pdf"?


Matthew Phillips
David Li
Greenhorn

Joined: Nov 23, 2000
Posts: 16
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){}
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet Response different from IE to Netscape