DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=41361>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=41361

           Summary: Content lost when read by a slow client.
           Product: Tomcat 5
           Version: 5.5.20
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Servlet & JSP API
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


Given the following servlet:

public class GreetingServlet extends HttpServlet
{
  public void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException
  {
    PrintWriter printWriter = response.getWriter();

    for (int i = 0; i < 10000; i++)
    {
      printWriter.println("Servlet test................ Line: " + i);

      if (printWriter.checkError())  // this causes a flush
      {
        System.err.println("An error occurred, " + i + " lines written.");
      }
    }

    printWriter.close();
  }
}



Only the first 4328 rows are available for the following client to read:

  public void testHTTPRead() throws Exception
  {

    URL url = new URL("http://localhost:/servlettest/test";);
    URLConnection conn = url.openConnection();
    InputStream inputStream = conn.getInputStream();

    // Note these timings are sensitive - invoking inputStream.available()
    // each second for 50 times and all the content can be read.
    for (int i = 0; i < 5; i++)
    {
      System.out.println(inputStream.available());
      Thread.sleep(10000);
    }

    InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
    BufferedReader in = new BufferedReader(inputStreamReader);

    String str;
    while ((str = in.readLine()) != null)
    {
      System.out.println(inputStream.available() + " " + str);
    }

  }


This may be related to bug 37627.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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

Reply via email to