I'm using an HttpsURLConnection to connect to an application. Everything is fine until i'm trying to use parameters(like username and password) in the request due to the fact that on server side null values are mapped to parameters.
HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();
connection.addRequestProperty("password", "xxxx");
connection.addRequestProperty("username", "aaaaaa");
connection.addRequestProperty("eventId","btnLogin");
connection.setRequestMethod("POST"); //$NON-NLS-1$
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty( "Accept", "*/*" );
BufferedReader in = new BufferedReader(
new InputStreamReader(
connection.getInputStream()));
String decodedString;
while ((decodedString = in.readLine()) != null) {
System.out.println(decodedString);
}
I mention that HttpsURLConnection works and the intial login page is retrived via HttpsUrlConnection.
How I could send successfully the paramters on the server side via a POST request.
Regards,