Here you can find the source of get(int port, String applicationRoot, String resource, String path)
public static String get(int port, String applicationRoot, String resource, String path) throws Exception
//package com.java2s; //License from project: Open Source License import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static String get(int port, String applicationRoot, String resource, String path) throws Exception { String url = "http://localhost:" + port + applicationRoot + resource + path; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); String line;/* w ww . j a v a2s . co m*/ StringBuilder response = new StringBuilder(); while ((line = in.readLine()) != null) { response.append(line); } in.close(); return response.toString(); } }