title: Best practice sending HTTP GET requests
body: <p>Is there better practice for sending HTTP GET requests than the following?</p>
  
  <pre><code>    private StringBuffer getData(String url)  throws Exception
  {
          URL obj; 
  
          obj = new URL(url);
          HttpURLConnection con = (HttpURLConnection) obj.openConnection();
          con.setRequestMethod("GET");
          int responseCode = con.getResponseCode();
  
          BufferedReader in = new BufferedReader(
                  new InputStreamReader(con.getInputStream()));
          String inputLine;
          StringBuffer response = new StringBuffer();
  
          while ((inputLine = in.readLine()) != null) {
              response.append(inputLine);
          }
          in.close();         
          return response;
  }
  </code></pre>