I am currently having problems posting data using a HttpsConnection.
I am setting the setRequestMethod to HttpConnection.POST and then using the openDataOutputStream method.
I will post my code when I get home for reference.
Background to my problem - I am trying to use the declarative security features of J2EE to authenticate a mobile user.
I am firstly firing a HttpsConnection from the mobile device to a protected resource on the app server. I grab the JSessionId from the Set-Cookie http header of the response and post a second request to the j_security_check and provide the refer http header to the protected resource - this simulates exactly what happens on a browser (I used a Http monitor tool to confirm this). However, I need to pass the j_username and j_password as body of the https request. This doesn't seem to work because the server displays my access denied at this point - as if it hadn't received the crednetials
However, just to confirm my technique works I subsituted the post request for a get request to j_security_check and passed the j_username and j_password as request params in the URL. This worked fine and I got a 302 response 'temporily moved' which I then handle by simply making a further request for the original resource - this time it serves back the resource because I am authenticated.
Anyway that sets the scene - so the problem definitely appears to be posting data using an HttpsConnection.