I realize I'm jumping in this one late, so forgive me if I restate what
some others have, but:

a) no, you shouldn't have to do anything with your web/app server at
all.

b) This is a bug with IE, in that it tends to ignore content types if it
thinks it 'knows' what the content is (by what the URL ends with), so as
others have said, you should be able to set the content type and either
set the URL to end with a '.pdf' or NOT end with it (then IE checks the
content type) The Cocoon site mentions this as well, as they have a FOP
example in their distro that out of the box doesn't work in IE because
the URL actually end in .xml so IE thinks it's an XML document even
though cocoon sets the content type.

c) What _exactly_ is happening? Are you getting a browser full of funky
text, nothing at all, crashing, etc.?

- Robert McIntosh

-----Original Message-----
From: John Ng [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, February 19, 2002 1:08 PM
To: Struts Users Mailing List
Subject: Re: FOP and strus (IE problem)

I still couldn't get it working in IE.  I use weblogic
as the webserver... Do I have to do anything specific
to weblogic?

Thanks
John

--- Arron Bates <[EMAIL PROTECTED]> wrote:
> Oh, what a world of pain.
> IE in this regard is a pile of *@!# and NS is the
> absolute honey  :)
> 
> This is off-struts, but I know the pain you go
> through to get IE going 
> properly.
> 
> Here's what I had to do to get it running
> reliably...
> 
> 
> // START CODE --==>>
> 
> // set the response type
> response.setContentType("application/pdf");
> // set the content details
> response.setHeader("Content-Disposition", "inline; 
> filename=ConfirmationLetter.pdf; ");
> 
> // creating a temporary output stream
> ByteArrayOutputStream bout = new
> ByteArrayOutputStream();
> 
> // this class takes teh xml document and runs it
> through the FOP process
> // and pumps it into the output stream created.
> OnlineSalesPDFGenerator pdf = new
> OnlineSalesPDFGenerator(xmlDoc);
> pdf.run(form,request,bout);
> 
> byte[] content = bout.toByteArray();
> 
> // set the exact content length from our temp output
> stream
> response.setContentLength(content.length);
> 
> // write the content
> response.getOutputStream().write(content);
> 
> // flush the stream
> response.getOutputStream().flush();
> 
> // <<==-- END CODE
> 
> 
> I went through a lot of pain to get all the
> alternatives people were 
> doing to get this. Important parts are...
> a) The response type.
> b) The Content-Disposition details. This sets
> filenames and stuff for 
> the file saving dialog boxes etc.
> c) Setting the exact content length. Made possible
> by writing to the 
> ByteArrayOutputStream and getting its resulting
> size.
> 
> And if you're pessimistic (most likely you are by
> now :), make sure you 
> flush and close the output stream, and you can also
> throw in what Gregor 
> says below with your URL. After the above though,
> you shouldn't have any 
> problems.
> 
> Hopefully this will get you where you need to be.
> 
> 
> Arron.
> 
> 
> Gregor Rayman wrote:
> 
> >"John Ng" <[EMAIL PROTECTED]> wrote:
> >
> >>Hi, The following is a piece of the code that I
> write
> >>in the perform method of an ActionForm to generate
> the
> >>PDF.  However, it works fine in netscape, but NOT
> IE. 
> >>Can someone help me with this?
> >>
> >>Thanks!
> >>John 
> >>
> >
> >Try adding "?.pdf" to the url.
> >
> >--
> >gR
> >
> >
> >--
> >To unsubscribe, e-mail:  
> <mailto:[EMAIL PROTECTED]>
> >For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> >
> 
> 
> 
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com

--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to