Hassan Schroeder wrote: > On 12/15/06, Scott Carr <[EMAIL PROTECTED]> wrote: >> Does a servlet require the use of a Content-Length for the Reader to be >> populated? > > A pretty cursory test seems to indicate not, but I could just be lucky > :-) > >> ...and I want to read each line as they come in, and handle the >> request on >> a line by line basis. > > Have you tried this yet? request.getReader() would seem to cover > your situation, assuming this isn't binary data. > Hm, the reason I asked, is because of a test I ran. strLine is always null.
Using the following code for processRequest: response.setContentType("text/plain"); m_out = response.getWriter(); m_bufRead = request.getReader(); while (true) { strLine = m_bufRead.readLine(); if (strLine != null) { if (strLine.startsWith("login")) { ProcessLogin(); } else if (strLine.startsWith("exit")) { break; } } else { try { Thread.sleep(1000); } catch (InterruptedException ex) { ex.printStackTrace(); } } } m_bufRead = null; m_out.close(); --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]