tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Reich, Matthias" <>
Subject RE: Comet: problem with request.getParameter() in Comet POST requests
Date Thu, 03 May 2007 07:57:36 GMT
 > -----Original Message-----
> From: Filip Hanik - Dev Lists [] 
> > Wouldn't every application which isn't as dumb as the chat example
> > (which does not care about the content it reads but simply passes it
> > back to it's clients) need to implement it's own mechanism to check
> > whether there is enough input available to start parsing a chunk of
> > data?
> >   
> huh? This exact same problem exist with regular servlets, and has 
> existed for the last 8 years.
> Filip

I have written some servlet code during the last years, but I never had
to deal with
the question if the servlet can start parsing - it simply does, and the
read operations on the stream block if necessary to wait until more data
is available to proceed.
(Or the servlet simply accesses request parameters of a POST request and
expects that they are available.)

The question whether I have to wait for another READ event before I have
the complete request available (or a complete message from a series of
messages transferred within the scope of one http request) only arises
if I am told that I should not do a blocking read.

So far I did not read a clear statement which says:

With Comet is is not desirable to do blocking read, but the API allows
to do it, as well in the BEGIN event handling as in the READ event

If this statement is true, I don't have any problem. The Servlet can
read all it expects to be delivered by the client when the client starts
a request (and don't care if it fits into one TCP packet or not, because
the read will block until the remaining TCP packets have arrived.)
Afterwards, there won't be anything more to be read until the client
sends the next message.
Thus, if the servlet gets a READ event, it can assume that the client
has sent a new message and read it.
(Again, the read will block if some TCP packets are missing which
contain remaining parts of the message.)

However, if the statement is not true, the Servlet has to care about
what is going on on the transport (TCP) level, and it has to count bytes
to know when a message is completely available.

So can you tell me: Is the above statement true?


To start a new topic, e-mail:
To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message