On 06/16/2009 09:36 PM, Caldarale, Charles R wrote:
From: Len Popp [mailto:len.p...@gmail.com]
Subject: Re: Reading POSTed data
Ah, but section 3.1.1 says that POST data is only available through
getParameter if the content type is application/x-www-form-urlencoded.
You're right, I missed that. There must be something else getting at the
request before the servlet has a chance to read it.
Looking at the code now, it doesn't look like it.
Is there any other code that calls getParameter or a related method
before you call getInputStream? Maybe in a filter?
What about the RequestDumperValve?
I'm honestly not sure (being an entire day into tomcat servlets), but I
don't believe so.
Full code:
public class Frontend extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
InputStream in = request.getInputStream();
response.setContentType("text/xml");
response.setCharacterEncoding("UTF-8");
response.setStatus(HttpServletResponse.SC_OK);
while (in.available() > 0)
out.write(in.read());
}
}
The document that tomcat sends back has the content type set properly,
but a Content-Length of 0.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org