Reputation: 2356
Generally, we use http connection like this:
try{
HttpClient httpclient = new DefaultHttpClient();
// final HttpParams params = httpclient.getParams();
// HttpConnectionParams.setConnectionTimeout(params, REGISTRATION_TIMEOUT);
// HttpConnectionParams.setSoTimeout(params, WAIT_TIMEOUT);
// ConnManagerParams.setTimeout(params, WAIT_TIMEOUT);
HttpPost httppost = new HttpPost(url);
HttpResponse response = httpclient.execute(httppost);
HttpEntity entity = response.getEntity();
is = entity.getContent();
}catch(Exception e){
// Log.e("log_tag", "Error in http connection "+e.toString());
}
This code snippet is used for http.
How can I request a secured connection (https) ?
Upvotes: 0
Views: 444
Reputation: 4943
If you are after Android 2.2, you can simply use class AndroidHttpClient.
It will be work through https, if url scheme is https.
Otherwise, you can look to its source and make similar, and may be even easier.
Upvotes: 1