• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unexpected command 31 when accessing a ServletInputStream

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.

 
reply
    Bookmark Topic Watch Topic
  • New Topic