Tomcat 7 by Dissection: How request parameters are set

NOTE: “Tomcat 7 by Dissection” is a collection of blogs pinpointing, and detailing some Tomcat 7  functionalities on code level . The blogs are meant as code “footprints” for the author.

I have encountered an issue in  one of the functionalities of a web application I maintain. Calls to BufferedReader.readLine() or read() just hang on every HTTP POST from a CGI script.  No error messages. No sirens. Nothing.

Realizing something was fundamentally wrong with the way the application (under a non-Tomcat container) handles HTTP POSTs, I started looking into how Tomcat 7 handles CGI HTTP POST transactions, got some ideas, and came up with a fix  for the problem. However, as I was testing the patch, I stumbled upon another issue – CGI module’s param() returns empty (or null) after an HTTP POST as if the page had been requested for the time. It looks like a Map object is dereferenced somewhere right before the response is sent to the client. It may be it but  I am not sure. I  need to investigate it further.  All these has lead me deeper into Tomcat codes than ever before in search for answers .

So, the code that sets the request parameters is found in org.apache.tomcat.util.http.Parameters class.

TC 7.0.12