pick a body of http post in servlet

I have a java app in which I posted a long text message to a servlet app.

I looked thru the HttpServletRequest class. it is not obvious how I pick up the text I sent. the text  data is not in an attribute, since I did not do a form post.

the HttpServletRequest object has a inputbuffer, which seems to be full of data. but how do I get to it?
bhomassAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Manikandan ThiagarajanSenior consultantCommented:
could you post the code now
bhomassAuthor Commented:
client side I did
                m_url = new URL ("http://"+SERVER+"/" + PROJPATH +"/"+ NEWREQUEST);
                m_urlConn = m_url.openConnection();

                m_urlConn.setDoInput (true);
                m_urlConn.setDoOutput (true);
                m_urlConn.setUseCaches (false);

                // Specify the content type.
//                urlConn.setRequestProperty
//                  ("Content-Type", "application/x-www-form-urlencoded");

                // Send POST output.
                m_req_os = new DataOutputStream (m_urlConn.getOutputStream ());
                String content =
                        "lots lots of text";
                      
                  m_req_os.writeBytes (content);
                m_req_os.flush ();

server side I have
      public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
            this.request = request;
                // herer is my question. How do I get content sent by the client?
      }
Ajay-SinghCommented:
In the serverSide, try adding this code:


ServletInputStream in = request.getInputStream();
...
Announcing the Winners!

The results are in for the 15th Annual Expert Awards! Congratulations to the winners, and thank you to everyone who participated in the nominations. We are so grateful for the valuable contributions experts make on a daily basis. Click to read more about this year’s recipients!

bhomassAuthor Commented:
I tried that. followed by

            ServletInputStream is = request.getInputStream();
            byte buf[] = new byte[1000];
            String contentString = "";
            int nread = 0;
            while (-1!=(nread=is.read(buf))){
                  contentString += new String(buf, 0, nread);
            }

but, I got 0 char's out of the input strream???
bhomassAuthor Commented:
ok, I added "body=" in front of the content in the client, and got it from request.getParameter("body") in the server;

not as elegant as I wanted, but this is good enough for me.
CetusMODCommented:
PAQed with points refunded (75)

CetusMOD
Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.