Wrox Programmer Forums
|
BOOK: Professional Apache Tomcat
This is the forum to discuss the Wrox book Professional Apache Tomcat by Chanoch Wiggers, Ben Galbraith, Vivek Chopra, Sing Li, Debashish Bhattacharjee, Amit Bakore, Romin Irani, Sandip Bhattacharya, Chad Fowler; ISBN: 9780764543722
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Apache Tomcat section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 21st, 2007, 01:21 PM
Registered User
 
Join Date: Aug 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Tomcat inside JBoss

I have a servlet, which generates pdf files to be displayed inside the browser. It works all the time in standalone Tomcat 5.5, but I can't find an answer why it is erratic inside JBoss.

After the servlet is run, JBoss returns an inconsistent and usually bad http response mime type to the browser. Mostly it becomes "application/octet-stream" instead of "application/pdf" which I explicitly set. But not always... This is the output part:

ServletOutputStream out = res.getOutputStream();
res.setContentType("application/pdf");
res.setContentLength((int)outfile.length());
bis = new BufferedInputStream(new FileInputStream(outfile));
bos = new BufferedOutputStream(out);
byte[] buff = new byte[2048];
int bytesRead;
while(-1 != (bytesRead = bis.read(buff, 0, buff.length)))
{
    bos.write(buff, 0, bytesRead);
}
bos.flush();
bos.close();







Similar Threads
Thread Thread Starter Forum Replies Last Post
Decent JBoss book? prateep All Other Wrox Books 0 November 24th, 2005 07:26 AM
Decent JBoss book? prateep J2EE 0 November 24th, 2005 07:25 AM
Similar book for JBoss? prateep BOOK: Professional Apache Tomcat 0 November 24th, 2005 07:24 AM
codes on JBOSS vishalmhaskar Wrox Book Feedback 0 September 18th, 2003 10:48 PM
JBoss 3.0 Deployment and Administration puiuvlad Wrox Book Feedback 7 August 1st, 2003 01:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.