Back to project page worldwondersproject.
The source code is released under:
MIT License
If you think the Android project worldwondersproject listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.ciandt.cursoandroid.worldwondersapp.integrator; /*from w w w . j a v a 2 s . c o m*/ import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.utils.URIUtils; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; import org.json.JSONObject; import java.net.URI; import java.net.URISyntaxException; public class BaseIntegrator { public Object doGetRequest(String protocol, String host, String path) throws URISyntaxException { URI uri = URIUtils.createURI(protocol, host, 80, path, null, null); HttpGet httpGet = new HttpGet(uri); HttpClient httpClient = new DefaultHttpClient(); JSONObject jsonObject = new JSONObject(); try { HttpResponse httpResponse = httpClient.execute(httpGet); HttpEntity httpEntity = httpResponse.getEntity(); String responseString = EntityUtils.toString(httpEntity); jsonObject = new JSONObject(responseString); } catch (Exception ex) { ex.printStackTrace(); } finally { return jsonObject; } } }