• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

("application/pdf") in websphere 4.0.3

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I downloaded JasperReport and deployed the sample webapps (JasperReportLetter) to websphere 4.0.3. I test it in IE5.5 and IE5.5 will display the result pdf in it's source code format, not triggering the Acrobat Reader plugin.
I put the same webapps to Tomcat 4.0.4, and use same IE5.5 browser to test it. This time it pop up the "File download" dialog, and I can save it to a file. Why's that?
Here is the source code from JaspeReport (letter.jsp):
<%@ page errorPage="jasperError.jsp" %>
<%@ page import="dori.jasper.engine.*" %>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.awt.*" %>
<%
File reportFile = new File(application.getRealPath("/JasperReportsLetter.jasper"));
Map parameters = new HashMap();
parameters.put("ReportTitle", "JasperReports Project Description");
parameters.put("BaseDir", reportFile.getParentFile());

byte[] bytes =
JasperRunManager.runReportToPdf(
reportFile.getPath(),
parameters,
new JREmptyDataSource()
);

response.setContentType("application/pdf");
response.setContentLength(bytes.length);
ServletOutputStream ouputStream = response.getOutputStream();
ouputStream.write(bytes, 0, bytes.length);
ouputStream.flush();
ouputStream.close();
%>
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This might be a JSP-compiler issue, but if you're having blank lines, spaces or whatever before your actual response.setContentType(...) these characters get written before the content-type is set, and thats not good.
My guess is that Tomcat and WebSphere compiles JSP:s diferently and thus the same JSP code produces different behaviours.
Try removing all linebreaks and so on between your import-statements and code-snipplets.
 
reply
    Bookmark Topic Watch Topic
  • New Topic