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?)
Originally posted by Dirk Schreckmann: (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?)
Hope this is not my book that you were talking about!
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!
SCJP,SCJD,SCEA,SCMAD,SCDJWS,SCJP5.0
Uh oh, we're definitely being carded. Here, show him this tiny ad:
Gift giving made easy with the permaculture playing cards