Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get the POST message?

 
yoga nandiwardhana
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i sent an http post with a message body from a midlet to a servlet. what is the easiest way to read the body on the servlet? i tried using inputstreams and then is.readLine and tried to append them to a stringbuffer but it didn't work. help please..
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried using a Reader in the request method getReader() returns a BufferedReader to read the Body of the request Object.
Mark
 
a sanjuan
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm confused here....what do you mean by message body, and reading from a servlet? are you sending binary data to the servlet?
httpservlets have a defined structure....if you are sending data using a POST method, then the doPost method can be used to parse out the data using request.getParameter("nameofvalue")....if you are sending multi-part data, then it's a bit more tricky, but i also doable (e.g. if you are uploading a file to the servlet).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic