Skip to content

Instantly share code, notes, and snippets.

@renatocantarino
Created June 20, 2013 17:26
Show Gist options
  • Save renatocantarino/5824755 to your computer and use it in GitHub Desktop.
Save renatocantarino/5824755 to your computer and use it in GitHub Desktop.
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