In my Android application, I send data to the servlet httpss url WebViewas below
String postData = "fileContents=" + fileCon;
WebView.postUrl(url, EncodingUtils.getBytes(postData, "BASE64"));
The URL of the above code is the URL of the servlet for which I have to post some data, and from there redirect to another URL.
The above code worked fine when the servlet URL is simple HTTP. But when changing to https, a blank screen is displayed.
I tried the following solution for the problem with android https:
http://blog.antoine.li/index.php/2010/10/android-trusting-ssl-certificates/
I removed the above code from the method onCreate()and tried the following code
ArrayList<NameValuePair> postParameters = new ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("fileContents", fileCon));
DefaultHttpClient client = new MyHttpClient(getApplicationContext());
try {
HttpPost request = new HttpPost(url);
UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(postParameters);
request.setEntity(formEntity);
HttpResponse resp = client.execute(request);
} catch(Exception e){
e.printStackTrace();
}
, . .
, loadUrl, postUrl ?
WebView?