This reminds me that with Cocoon you generally specify a URL of
whatever.something?dummy=file.pdf even when the mime type is correct.

David Morris

>>> gilles.kuhn@xxxxxxxxxxxx 1/9/2004 11:06:31 AM >>>
cornelius, chad wrote:
> Yeah...  I dropped it where all my jsp files reside.
> 
> Thanks,
> Chad
> 
> 
> -----Original Message-----
> From: Ashish Kulkarni [mailto:kulkarni_ash1312@xxxxxxxxx] 
> Sent: Thursday, January 08, 2004 2:32 PM
> To: Java Programming on and around the iSeries / AS400
> Subject: Re: Opening PDF Files throught Tomcat
> 
> Hi
> did u drop it like in a folder where u have all your
> jsp , html files etc, in this case it should work,
> I guess must be some setting in IE which is not able
> to handle it, 
> not sure please reconfirm

If you serve the file directly through the servlet OutputStream, it 
could be a MIME-Type problem, try to specify it in HTTP Headers.
If the browser request your pdf file with a file name which doesn't end

with ".pdf", maybe you should set the file name to "myfile.pdf" on 
server side.

public void doGet(HttpServletRequest req, HttpServletResponse res)
                throws ServletException, IOException
{
                res.setContentType("application/pdf");
                res.setHeader(
                        "Content-Disposition",
                        "inline; filename= myfile.pdf" );
                ...
}



If you serve the file with a res.sendRedirect("path_to_my_pdf"),
check also that pdf MIME type is defined in the tomcat/conf/web.xml
file:
...
     <mime-mapping>
         <extension>pdf</extension>
         <mime-type>application/pdf</mime-type>
     </mime-mapping>
...

I hope this helps. But generally speaking, trying to display files
which 
are not HTML, gif or jpeg is a browser dependant problem. But if it 
works with a normal static HTML apache web server, with those 
mofifications it should work with TOMCAT as well.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.