Output From RESTful Web Service:
<%
out.println("");
// Use the java.net.* APIs to access the RESTful web service
HttpURLConnection connection = null;
BufferedReader rd = null;
StringBuilder sb = null;
String line = null;
URL serverAddress = null;
try {
serverAddress = new URL("http://localhost:8080/v3RocksRESTServices/resources/helloService");
connection = (HttpURLConnection) serverAddress.openConnection();
connection.setRequestMethod("GET");
connection.setDoOutput(true);
connection.setReadTimeout(10000);
// Make the connection
connection.connect();
// Read in the response
rd = new BufferedReader(
new InputStreamReader(connection.getInputStream()));
sb = new StringBuilder();
while ((line = rd.readLine()) != null) {
sb.append(line);
}
out.println(sb.toString());
} catch (Exception e) {
e.printStackTrace();
}
out.println("
");
%>