Then how to handle it? or there is no way?
Brian Sanders <brian.j.sanders@mindspring.com> wrote:
You're seeing the servlet output 3 times because 3 separate requests are
being made. If you use IE 5.5, you'll see 2 requests. This is the way
Internet Explorer behaves when loading content with a plug-in.
For request #1, IE reads the content type to be PDF, so it closes that
connection immediately. Then, it sends another request where the
User-Agent header has the value "contype". The only thing you have to
return for this request is the Content-Type header (e.g., call
response.setContentType("application/pdf") then output nothing in the
body). The third request is actually from the plug-in.
> And the output of this servlet is:
>
> 0
>
> 0
>
> 0
>...
>
> Another thing I notices is that: if I comment the following code:
>
> response.setContentType("application/pdf");
>
> then the problem is gone. I use PDF format because I am using iText tool
> to general pdf file and print it. Is it possible that since it takes
> some time to open acrobat reader, it generates multiple threads by
> itself? I call the servlet directly from the location bar of the
> Internet Explorer.
--
Brian Sanders
Java Developer