I’m building something using Google App Engine and I’m trying to create a java Servlet that reads the raw POST data and does something with it. According to the servlet documentation, this should be possible using either the getReader() method or the getInputStream() method. However it appears that somehow, at least with the App Engine development server that runs locally on my dev box, getInputStream() has already been called before the doPost method is even entered.
My evidence for asserting this is as follows:
- getReader throws a java.lang.IllegalStateException (see this)
- getInputStream returns a valid input stream, but calling read() on that input stream returns -1 (see this).
I checked and I am not calling getParameter() before I call getInputStream. getInputStream() is the FIRST thing I call in the body of the doPost method.
What is wrong here?
Per this link from google app engine issue tracker :