private String get() { String response = ""; try { URL connectURL = new URL("http://localhost:8182/lightControlPage/statusAll"); HttpURLConnection conn = (HttpURLConnection)connectURL.openConnection(); // do some setup conn.setDoInput(true); conn.setDoOutput(true); conn.setUseCaches(false); conn.setRequestMethod("GET"); // connect and flush the request out conn.connect(); conn.getOutputStream().flush(); // now fetch the results response = getResponse(conn); Displaymsg(response); } catch(Exception ex) { return ex.getMessage(); } return response; //return response; } private String getResponse(HttpURLConnection conn) { InputStream is = null; try { is = conn.getInputStream(); return is.toString(); } catch(Exception e) { } finally { } return is.toString(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)