How Return Response From A RestService


private static String getRestCallResponse(String restURL) throws IOException {

		String output = "";
		StringBuffer response = new StringBuffer("");

		URL url = new URL(restURL);
		HttpURLConnection conn = (HttpURLConnection) url.openConnection();
		conn.setRequestMethod("GET");

		BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));

		while ((output = br.readLine()) != null) {
			response = response.append(output);
		}

		conn.disconnect();

		return response.toString();
	
}

Comments

Popular posts from this blog

CSM Quiz -1

CSM GrandTest

CSM Quiz -2