You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by "Lee, Insoo" <In...@gs.com> on 2003/05/17 08:36:15 UTC

FOP servlet is called multiple times!!

 How would we trouble shoot this?
 We never saw this happening until we rolled out our app to the production,
which uses https.
 And it does not happen consistently!!

 Help!!
 We see this on FOP FAQ, and the second bullet point says we should not set
any headers - we are not setting anything unusual - except below.

	response.setContentType( CONTENT_TYPE_PDF );  // where
CONTENT_TYPE_PDF is application/pdf
            response.setHeader( "Content-Disposition", "attachment;
filename="
                   + reportTag + "_" + FormatterUtils.formatDate(
gCal.getTime(), FormatterUtils.dMMMyyyy ) 

 

7.1. The FOP servlet is called multiple times!^ 
This is a problem of Internet Explorer requesting the content several times.
Some suggestions: 
*	Use an URL ending in .pdf, like http://myserver/servlet/stuff.pdf
<http://myserver/servlet/stuff.pdf> . Yes, the servlet can be configured to
handle this. If the URL has to contain parameters, try to have both the base
URL as well as the last parameter end in .pdf, if necessary append a dummy
parameter, like http://myserver/servlet/stuff.pdf?par1=a&par2=b&d=.pdf
<http://myserver/servlet/stuff.pdf?par1=a&par2=b&d=.pdf> . The effect may
depend on IEx version. 
*	Give IEx the opportunity to cache. In particular, ensure the server
does not set any headers causing IEx not to cache the content. This may be a
real problem if the document is sent over HTTPS. Consult your server manual.

*	Cache in the server. Including a parameter in the URL which has a
timestamp as the value may help you to decide whether a request is repeated.
IEx is reported to retrieve a document up to three times, but never more
often. 		-> what does it mean????/




Re: FOP servlet is called multiple times!!

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Lee, Insoo wrote:
>  We never saw this happening until we rolled out our app to the production,
> which uses https.

Suggestion: Don't use HTTPS for downloading the PDF.

>  We see this on FOP FAQ, and the second bullet point says we should not set
> any headers

You should not set headers which cause the browser *not* to chache,
please read carefully.
Also, setting only a few standard headers doesn't mean the browser
will always cache the PDF content, most browsers don't do this until
specific headers are set which tell the browser there is an opportunity
to cache. I don't know how to do this, you should ask on a list
specializing in configuring web servers.
Note that even if you set headers which tell the browser the content
can be cached it still isn't oblieged to do so. In particular many IEx
builds (not all) turn off caching for content delivered over HTTPS
completely. If you insist on delivering the PDF over HTTPS, there is
no way to avoid multiple calls for the same URL if the client is IEx.
Either tell your clients to use Mozilla, or complain to MS that they
goofed.

> *	Cache in the server. Including a parameter in the URL which has a
> timestamp as the value may help you to decide whether a request is repeated.
> IEx is reported to retrieve a document up to three times, but never more
> often. 		-> what does it mean????/

Detect whether the servlet was called a second (or third) time for the
same URL, and reuse cached content rather then generate the PDF again.


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