From the documentation of HttpConnection, I thought I understood that the request parameters had to be sent before an output stream was established, but I couldn't figure out another mechanism for sending request parameters. I'd not realized that POST request parameters could be sent as part of the URL, as GET request parameters are sent. (I was following an example from a book for making a POST request, which also didn't work for me. Who knew you can't believe everything you read?)
Your code is perfectly valid. The missing POST parameter is due to a known issue (a perf optimization infact!) where in the Transfer-encoding:chunked HTTP header gets set automatically when you do an out.flush(). You basically loose the POST data if the webserver is unable to recognise a chunked request properly.
So just comment out the out.flush() from your code and see the magic!
Beauty is in the eye of the tiny ad.
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database