I'm looking at the documentation here: http://docs.oracle.com/javase/7/docs/api/java/net/URLConnection.html
I'm not seeing an option to flag a request as a POST method. I'd expect to see .setRequestMethod("POST");
or something. Am I looking at the wrong documentation?
I'm using Android 4.2 and Java 1.6. Though I'm unsure if javase/1.4.2
is what I should be looking for.
URL url = new URL(this.getUrl());
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty("charset", "utf-8");
connection.setRequestProperty("Content-Length", "" + Integer.toString(urlParameters.getBytes().length));
connection.setUseCaches (false);