Hi,
I am opening a HttpURLConnection(new URL(https://url))
I am able to post login credentials as follows in case of http:// URL:
HttpURLConnection urlConnectionLogin = null;
OutputStream outputStream = null;
// Open connection
urlConnectionLogin = (HttpURLConnection) url.openConnection();
// Set properties of the connection
urlConnectionLogin.setRequestMethod("POST");
urlConnectionLogin.setDoInput(true);
urlConnectionLogin.setDoOutput(true);
urlConnectionLogin.setUseCaches(false);
urlConnectionLogin.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
// Form the POST parameters
StringBuilder content = new StringBuilder();
content.append("userName=").append(URLEncoder.encode("username"));
content.append("&userPassword=").append(URLEncoder.encode("password"));
if (urlConnectionLogin != null) {
outputStream = urlConnectionLogin.getOutputStream();
outputStream.write(content.toString().getBytes("UTF-8"));
outputStream.close();
// Retrieve the output
int responseCode = urlConnectionLogin.getResponseCode();
This works fine in case of http URL.
But in case of https:// URL userid and password have no effect.Can someone
please post working code for posting userid and password in case of https
urls.
Regards
Raj
--
View this message in context:
http://www.nabble.com/Posting-login-credentials-to-https-url-tf4360040.html#a12425970
Sent from the cxf-dev mailing list archive at Nabble.com.