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 15:26:38 GMT
> How about not arguing about everything ? It is your fault when
> parameters are not processed. Tomcat will process parameters with
> comet.
No, Comet will not process parameters in POST requests if you call 
getParameter() in the BEGIN event and the request body has not yet 
arrived. getParameter() will return null even if the parameter is set in 
the request body. How is this my fault? How do I know when to call 
getParameter()? How exactly am I supposed to process the POST parameters 
in a Comet request?

>> You need the IO event to free up more than just the memory. The file
>> descriptor also needs to be freed; this was causing problems for me 
>> earlier.
> Then set a shorter timeout, allow an appropriate amount of file
> descriptors, or produce an IO event. It is possible that a notify
> method (or something like that) could be added on the event to make it
> a bit more straightforward.
The first two are workarounds which start failing quite quickly when 
there is a high number of requests. As for the last option, how do 
"produce and IO event" on the input stream on the server side? It's the 
client that produces IO events on the input stream, and I have no 
control over the client.

By the way, in RFC 2616 it says: HTTP/1.1 defines the "close" connection 
option for the sender to signal that the connection will be closed after 
completion of the response.

So as far as I can tell it's not even required for the client to close 
the input stream after reading Content-Length bytes. It could very well 
wait for the server to close the request, which means that Comet 
receives no IO event and we end up having to wait for a TIMEOUT event.

So please tell me how to "produce an IO event".

> The way to sync is according to what your application does. The chat
> mini example has a very simple sync structure. The sync depends on
> what the application is doing. The only official stance is that none
> of the structures that the Servlet API provides are synced.
I don't see how this is enough information. Obviously I need to 
synchronize access to the output stream of the repsonse object. But 
internally, Tomcat uses this object too. For example, it closes the 
output stream in the event.close() method. Without me knowing when and 
how Tomcat uses this object, how am I supposed to know how to do the 

For example, there is no explanation in the chat example why there is a 
synchronized (connections) block in the READ event. It looks like it's 
in there to syncrhonize access to the list, which could possibly be 
avoided with a CopyOnWriteArrayList. However, using a concurrent list 
and using synchronization on the output stream would break the chat 
program (because event.close() seems to internally access the output 

> Rémy


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

View raw message