tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sebastiaan van Erk <>
Subject Re: Comet: problem with request.getParameter() in Comet POST requests
Date Wed, 02 May 2007 21:01:47 GMT

> I have no problem to get POST parameter with NIO Connector at my 
> begin.event.  With APR connector I also have POST parameter problems. 
> Strange! A my first request I get the POST parameter. The POST message 
> close the event and I got an exception after  the end event.
It's a race condition and the problem occurs quite infrequently 
(especially with small request bodies). The larger the request body of 
the POST request, the more likely it is that the problem occurs. I was 
testing at a few thousand request per second, and even then it rarely 
showed up. The fact that other people out there are using getParameter() 
on Comet POST requests and expect it to work seems to me to warrant 1) 
acknowledgement that it is a bug, 2) a warning in the documentation, or 
3) a request facade for the Comet API which throws an exception when the 
getParameter() method is called on a POST request.

The problem occurs when the post data is not yet received on the server 
when the getParameter() method is called. This is very easy to simulate: 
simply use telnet to your webserver port and copy paste the request 
headers (including the empty line), but WITHOUT the request body to your 
Comet servlet. Then you will see that you get a BEGIN event and the 
getParameter() call returns null. Then you can paste the rest of the 
request body, but it will be too late. If the request body is large than 
this problem is more likely to occur because the data is split over 
multiple TCP packets.

> Currently we have no IO Event, but Remy has wrote a proposal to dev 
> list :-)
> I thing we need this feature.  +1
Ah, I will browse the dev list archives; I have found a workaround 
currently, but I am interested in the developments for future projects.


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

View raw message