File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java Micro Edition and the fly likes how to get the POST message? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "how to get the POST message?" Watch "how to get the POST message?" New topic

how to get the POST message?

yoga nandiwardhana

Joined: Mar 18, 2003
Posts: 8
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

Joined: Feb 05, 2001
Posts: 17276

Have you tried using a Reader in the request method getReader() returns a BufferedReader to read the Body of the request Object.

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
a sanjuan
Ranch Hand

Joined: Jun 12, 2002
Posts: 164
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).
I agree. Here's the link:
subject: how to get the POST message?
It's not a secret anymore!