A quick read through the source code
(org/apache/catalina/connector/Request.java) reveals -

The first read of getParameter() will consume the request body form
params and store them in a cache so that subsequent calls don't need to
iterate over the request a second time. (This definitely seems like the
desired behavior for the majority of use-cases)

So it looks like you can't both read the request bytes by hand and use
the Request helper methods, at least not in a trivial fashion.

Chris

-----Original Message-----
From: John Cartwright [mailto:john.c.cartwri...@noaa.gov] 
Sent: Thursday, December 11, 2008 4:10 PM
To: Tomcat Users List
Subject: reading request parameter invalidates post body

Hello All,

I'm using tomcat 6.0.18 and it appears that reading a request parameter 
like:

String param = request.getParameter("param");

causes any subsequent attempt to ready the post body to fail:

while ((inputLine = reader.readLine()) != null) {
            sb.append(inputLine);
}

It doesn't throw an exception, just doesn't find any lines to read in 
the post body.  Commenting out the request.getParameter call causes the 
read of the post body to work normally.  Is this expected behavior?  Can

someone please clarify for me?

Thanks!

--john


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to