tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Koes, Derrick" <Derrick.K...@smith-nephew.com>
Subject RE: Stream PDF using servlet
Date Thu, 24 Apr 2003 16:37:30 GMT

Is Tomcat running as a service?

If you installed Tomcat using the tomcat installer, the memory parameters
are assigned for you (to defaults--max 128MB, I think).  You may need to
adjust how much heap size the VM has.  If running as a service you will have
to use tomcat.exe to re-create the service with larger memory parameters.
If running from command line, you can simply add the heap settings as
JAVA_OPTS in catalina.bat/catalina.sh.

-----Original Message-----
From: Mark Lenz [mailto:MLenz@piercemfg.com] 
Sent: Thursday, April 24, 2003 12:12 PM
To: tomcat-user@jakarta.apache.org
Subject: Re: Stream PDF using servlet



Thank you Lior.  That seemed to help the IE error but now I'm getting an
error from Acrobat Reader before it opens the file saying "File does not
begin with '%PDF-'.".  I think it may be because the link doesn't end with
.pdf.  So I tried to add ?x=dummy.pdf to the end of my URL, but it still
gives me the '%PDF-' error.

Mark Lenz
Pierce Manufacturing, Inc.
(920) 832-3523
mlenz@piercemfg.com

                                                                           
  Lior Shliechkorn                                                         
  <liorshliech@yahoo.com>                 To:        Tomcat Users List     
                                  <tomcat-user@jakarta.apache.org>         
                                          cc:                              
  04/24/2003 09:46 AM                     Subject:        Re: Stream PDF   
  Please respond to "Tomcat Users using servlet                            
  List"                                                                    
                                                                           





Lucky for you I just fixed this problem recently. Take out the setHeader
(..) that have to do with the no-cache and try again.

Mark Lenz <MLenz@piercemfg.com> wrote:
I'm trying to stream a PDF to a browser using a servlet. It works fine
using Mozilla. But, sure enough, I just can't get it to work with IE
(great standards compliance!). When I try to download the PDF through IE
(6.0), it asks me what I want to do (open or save the file). If I choose
open I get an error "Internet Explorer was not able to open this Internet
site. The request site is either unavailable or cannot be found. Please
try again later.". Here's the code from my servlet for streaming the PDF:

...
File pdf_file = new File("
");
if (!pdf_file.exists())
{
//display error message
...
return;
}
else
{
int filesize = (int)pdf_file.length();
res.setContentType("application/pdf");
res.setContentLength(filesize);
res.setHeader("Pragma", "no-cache");
res.setHeader("Cache-Control", "no-cache");
ServletOutputStream out = res.getOutputStream();

byte[] data = new byte[filesize];
DataInputStream in = new DataInputStream(new
FileInputStream(pdf_file));
in.readFully(data);
in.close();
out.write(data);
out.flush();
out.close();
}
...

I must be missing a simple thing that IE requires. Anyone have any ideas?
Thanks.

Mark Lenz
Pierce Manufacturing, Inc.
(920) 832-3523
mlenz@piercemfg.com

The information contained in this electronic mail message is confidential
information and intended only for the use of the individual or entity named
above, and may be privileged. If the reader of this message is not the
intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If
you have received this transmission in error, please contact the sender
immediately, delete this material from your computer and destroy all
related paper media. Please note that the documents transmitted are not
intended to be binding until a hard copy has been manually signed by all
parties.
Thank you.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.



The information contained in this electronic mail message is confidential
information and intended only for the use of the individual or entity named
above, and may be privileged. If the reader of this message is not the
intended recipient, you are hereby notified that any dissemination,
distribution or copying of this communication is strictly prohibited. If
you have received this transmission in error, please contact the sender
immediately, delete this material from your computer and destroy all
related paper media. Please note that the documents transmitted are not
intended to be binding until a hard copy has been manually signed by all
parties.
Thank you.



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
This electronic transmission is strictly confidential to Smith & Nephew and
intended solely for the addressee.  It may contain information which is
covered by legal, professional or other privilege.  If you are not the
intended addressee, or someone authorized by the intended addressee to
receive transmissions on behalf of the addressee, you must not retain,
disclose in any form, copy or take any action in reliance on this
transmission.  If you have received this transmission in error, please
notify the sender as soon as possible and destroy this message.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message