private HttpURLConnection doHTTPGetRequest(String location,String clientSessionId,Map<String,String> metadata) throws CommunicationException {
  try {
    URL url=new URL(location);
    HttpURLConnection connection=(HttpURLConnection)url.openConnection();
    if (clientSessionId != null) {
      connection.addRequestProperty(HTTP_HEADER_SESSION_ID,"GCS v1Client:" + clientSessionId);
    }
    if (metadata != null) {
      connection.addRequestProperty(HTTP_HEADER_METADATA,GcUtil.getBase64EncodedMetadata(metadata));
    }
    if (Constants.ENABLE_REQUEST_LOGGING) {
      logRequest(connection,null);
    }
    if (connection.getResponseCode() != 200) {
      throw new CommunicationException("No status 200 received, status is :" + connection.getResponseCode());
    }
    return connection;
  }
 catch (  MalformedURLException e) {
    Log.e(TAG,"doHTTPGetRequest, Unable to parse url " + location);
    throw new CommunicationException("Unable to parse url " + location);
  }
catch (  IOException e) {
    Log.e(TAG,"doHTTPGetRequest, IOException while opening connection " + e.getMessage());
    throw new CommunicationException("IOException while opening connection " + e.getMessage(),e);
  }
}

private HttpURLConnection doHTTPGetRequest ( String location , String clientSessionId , Map < String , String > metadata ) throws CommunicationException { try { URL url = new URL ( location ) ; HttpURLConnection connection = ( HttpURLConnection ) url . openConnection ( ) ; if ( clientSessionId != null ) { connection . addRequestProperty ( HTTP_HEADER_SESSION_ID , "GCS v1Client:" + clientSessionId ) ; } if ( metadata != null ) { connection . addRequestProperty ( HTTP_HEADER_METADATA , GcUtil . getBase64EncodedMetadata ( metadata ) ) ; } if ( Constants . ENABLE_REQUEST_LOGGING ) { logRequest ( connection , null ) ; } if ( connection . getResponseCode ( ) != 200 ) { throw new CommunicationException ( "No status 200 received, status is :" + connection . getResponseCode ( ) ) ; } return connection ; } catch ( MalformedURLException e ) { Log . e ( TAG , "doHTTPGetRequest, Unable to parse url " + location ) ; throw new CommunicationException ( "Unable to parse url " + location ) ; } catch ( IOException e ) { Log . e ( TAG , "doHTTPGetRequest, IOException while opening connection " + e . getMessage ( ) ) ; throw new CommunicationException ( "IOException while opening connection " + e . getMessage ( ) , e ) ; } }
does a get request with httpurlconnection
