Caldarale, Charles R wrote:
From: Kyle Brantley [mailto:k...@averageurl.com]
Subject: Reading POSTed data

I'm trying to read data which is posted directly to the server.

I'll assume you have a doPost() method in your servlet.


I do.

I cannot figure out how to read this posted data from the servlet.

Read the servlet spec, not just the javadocs; section 3.1 discusses how POST 
data should be retrieved

Hey thanks, I will.

(as parameters).  Even if you limit yourself to the javadocs, you should have 
noticed this in ServletRequest.getParameter():

"If the parameter data was sent in the request body, such as occurs with an HTTP 
POST request, then reading the body directly via getInputStream() or getReader() can 
interfere with the execution of this method."

The variations of getParameter(), especially getParameterMap(), can be quite 
useful.

A simple example:
http://www.javareference.com/jrexamples/viewexample.jsp?id=101

The getParameter() calls are going to be of little to no value for me. The data isn't in a form where those calls would recognize them. Unless I'm missing something very obvious...?

But thanks for the bit about the possible interference in method calls. I'll be sure to check that I'm not calling those combinations of methods - I'm decently sure that at least twice I had both in, just to try and get it working.


 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.


---------------------------------------------------------------------
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