Why do you want to read POST by using reader ? I only use the stream from
request on a PUT request.
On 12/16/06, Scott Carr <[EMAIL PROTECTED]> wrote:
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: [email protected]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
-Andre-
PCs are like air conditioner, if you open Windows, they don't work