Hi everyone, I have an app that generates reports in PDF format and streams 
them to the client browser from a servlet. The report viewer page has an <embed 
tag which calls the servlet, which then streams the PDF to the client. 

This works beautifully in my JDEV/OC4J environment. When I deploy to JBOSS 
3.2.4 (JVM 1.4.2_03) is stops working and gives me one of these errors:

File does not start with ?%PDF-? (most frequently)
The file is damaged and could not be repaired
File connection timed out

Any ideas would be greatly appreciated!!!

I have tried all of the following suggestions gleaned from your and other 
forums:

Web.xml:

<servlet>
  | <servlet-name>eStarReport.pdf</servlet-name>
  | <servlet-class>com.estar.servlet.eStarImageServlet</servlet-class>
  | </servlet>
  | <servlet-mapping>
  | <servlet-name>eStarReport.pdf</servlet-name>
  | <url-pattern>/com.estar.servlet.eStarImageServlet</url-pattern>
  | </servlet-mapping>
  | 
  | <mime-mapping>
  | <extension>pdf</extension>
  | <mime-type>application/pdf</mime-type>
  | </mime-mapping>

Code that streams the pdf :

arResponse.setContentType("application/pdf");
  | arResponse.setHeader( "Content-disposition", "inline; 
filename=eStarReport.pdf"); 
  | arResponse.setHeader("Cache-Control", "no-cache");
  | also tried: arResponse.setHeader( "Cache-Control", "max-age=30");
  | also tried :arResponse.setHeader( "Cache-Control", "must-revalidate"); 
  | ByteArrayOutputStream ltestStream = new ByteArrayOutputStream();
  | this.outputReportPDF(ltestStream);
  | arResponse.setContentLength(ltestStream.toByteArray().length);
  | OutputStream lResponseStream = arResponse.getOutputStream();
  | ltestStream.writeTo(lResponseStream);
  | if (! arResponse.isCommitted()) arResponse.flushBuffer();

Tag on Report Viewer page:

<EMBED ID="Report_Object" 
SRC="eStarReport.pdf;JSESSIONID=2B14CDC409E1B5FC5096B9E0A209009E?REPORT_ID=26526028"
 width="100%" height="768">


View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3879093#3879093

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3879093


-------------------------------------------------------
SF.Net email is sponsored by: GoToMeeting - the easiest way to collaborate
online with coworkers and clients while avoiding the high cost of travel and
communications. There is no equipment to buy and you can meet as often as
you want. Try it free.http://ads.osdn.com/?ad_id=7402&alloc_id=16135&op=click
_______________________________________________
JBoss-user mailing list
JBoss-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to