Created
August 12, 2012 02:14
-
-
Save azuby/3329023 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HttpResponse response = null; | |
HttpEntity entity = null; | |
if (requestType.equalsIgnoreCase("get")) { | |
HttpGet httpGet = new HttpGet(url); | |
if (parameters != null) { | |
httpGet.setEntity(new UrlEncodedFormEntity(parameters)); | |
} | |
httpGet.setHeader("Accept", acceptHeader); | |
response = httpClient.execute(httpGet); | |
} else if (requestType.equalsIgnoreCase("post")) { | |
HttpPost httpPost = new HttpPost(url); | |
if (parameters != null) { | |
httpPost.setEntity(new UrlEncodedFormEntity(parameters)); | |
} | |
httpPost.setHeader("Accept", acceptHeader); | |
response = httpClient.execute(httpPost); | |
} | |
entity = response.getEntity(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment