Hi I'm trying to post a file to a servlet. Everything seems to be ok on application side, but the servlet doesn't work very well. In the doPost method, I get the headers from the HttpServletRequest (filename, contentlength,...) and then get the inputStream. Headers contents are correct. I try to write what comes from the inputStream (wrapped in a BufferedInputStream) to a FileOutputStream (wrapped in a BufferedOutputStream). When all is done, I would like to send a special status code (like 209) that means the file has been saved correctly and fully on the server. But the servlet seems to have problems. Since I get the inputStream, it often crash with an IOException "Unexpected command 31". (stack follows) I don't understand why, I don't know what is wrong with my code. (see http://www.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=7&t=007313) Help me please. Thanks.
I've had something similiar also when posting a file to a servlet. This time, the code works on one implementation of ColdFusion/JRun and not on another. I get a different error number, but the problem sounds very familiar.
Here's the code that was calling it. I was using Commons FileUpload 1.2 and Commons IO 1.3.1. Servlet.jar came from Apache because JRun does not provide one strangely enough. Note, this servlet has a get and a post - the get works fine.
subject: Unexpected command 31 when accessing a ServletInputStream