Jump to content
JasperReports Library 7.0 is now available ×

Problem in outputing PDF file via SSL


Recommended Posts

By: Kat Yo - katyo

Problem in outputing PDF file via SSL

2003-04-25 02:01

Dear all,

 

I plan to use JasperReport to generation report for my web application which is developed in STRUTS & EJB. My web application server is JBOSS3.0-Tomcat4.1.

 

I have successfully generated report in PDF and send to user's IE browser for displaying (in a new window) . However, when enabling SSL on JBOSS, the PDF cannot be displayed on user's browser ! Would anybody can help ? Thanks a lot !

 

 

Following is the code portion in an action servlet for generating PDF to user's IE web browser :

================================================================================================

 

:

:

byte[] bytes = null;

Map parameters = new HashMap();

 

parameters.put("ReportTitle", "Address Report");

 

try{

bytes = JasperRunManager.runReportToPdf(context.getResourceAsStream(Constants.CoTrnRep_Loc), parameters, jrs);

}catch (JRException e){

e.printStackTrace();

}

 

if (bytes != null && bytes.length > 0){

response.setContentLength(bytes.length);

response.setContentType("application/pdf");

response.setHeader("Content-disposition","inline; filename=" +"Report.pdf" );

ServletOutputStream ouputStream = response.getOutputStream();

ouputStream.write(bytes, 0, bytes.length);

ouputStream.flush();

ouputStream.close();

}else{

response.setContentType("text/html");

PrintWriter out = response.getWriter();

out.println("<html>");

out.println("<head>");

out.println("<title>Staff Training System - Report Generation</title>");

out.println("<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">");

out.println("</head>");

out.println("<body bgcolor="white">");

out.println("<br><center><bold>No record found !</bold></center>");

out.println("</body>");

out.println("</html>");

}

}

:

:

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...