This is the documented behavior of IE. It calls 3 times before finally getting the document. Search the mailing list for "3 times" for more details.
Best Regards, Paulo Soares ----- Original Message ----- From: "Lynn Young" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, March 06, 2003 19:38 Subject: [iText-questions] servlet multiple loops, help please > Hi, > > Following is a very simple servlet code, please help: > > public class PrintCheck1 extends HttpServlet implements > SingleThreadModel > { > public synchronized void doGet (HttpServletRequest request, > HttpServletResponse response) throws IOException, ServletException { > > > String transactionID = request.getParameter("transactionID"); > > if(transactionID == null) transactionID = ""; > int total = 0; > > response.setContentType("application/pdf"); > ByteArrayOutputStream ba = new ByteArrayOutputStream(); > > if(!transactionID.equals("")){ > try { > System.out.println(total); > total ++; > }catch(Exception e){ > System.out.println(e.toString()); > }finally{ > transactionID = ""; > } > > }//end of if > > }//end of doGet > > public synchronized void doPost (HttpServletRequest request, > HttpServletResponse response) throws IOException, ServletException { > System.out.println("get called from doPost"); > doGet(request, response); > }//end of doPost > } > > And the output of this servlet is: > > 0 > > 0 > > 0 > > I think this is because multiple threads are running. But: > > 1. I am the only client to call this servlet; > > 2. This class already implements SingleThreadModel; > > 3. Every variable associated with the request is declard with the doGet > method; > > 4. doGet method is synchronized; > > 5. If anything is executed in try block, then finally will be called, > which set the variable transactionID to empty string. > > It seems there are 3 thread running the servlet, why? I think I've done > everything needed to control the servlet in a single thread. > > Another thing I notices is that: if I comment the following code: > > response.setContentType("application/pdf"); > > then the problem is gone. 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. > > Anyone has same experience? Thanks in advance. > > Lynn > > > > > > > _____ > > Do you Yahoo!? > Yahoo! Tax Center > <http://rd.yahoo.com/finance/mailtagline/*http://taxes.yahoo.com/> - > forms, calculators, tips, and more > ------------------------------------------------------- This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger for complex code. Debugging C/C++ programs can leave you feeling lost and disoriented. TotalView can help you find your way. Available on major UNIX and Linux platforms. Try it free. www.etnus.com _______________________________________________ iText-questions mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/itext-questions