Created
June 20, 2013 17:26
-
-
Save renatocantarino/5824755 to your computer and use it in GitHub Desktop.
This file contains 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
import java.io.IOException; | |
import java.net.HttpURLConnection; | |
import java.net.URL; | |
public class Program { | |
/** | |
* @param args | |
* @throws IOException | |
*/ | |
public static void main(String[] args) throws IOException | |
{ | |
final String REST_ENDPOINT = "http://localhost:4895/restservice/"; | |
java.net.URL _urlEndPoint = new URL(REST_ENDPOINT); | |
java.net.HttpURLConnection _request = (HttpURLConnection) _urlEndPoint.openConnection(); | |
_request.setRequestMethod("GET"); | |
_request.connect(); | |
java.io.BufferedReader rd = new java.io.BufferedReader(new java.io.InputStreamReader(_request.getInputStream())); | |
StringBuilder response = new StringBuilder(); | |
String line = null; | |
while ((line = rd.readLine()) != null) | |
{ | |
response.append(line + '\n'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment