private static MethodCallRetVal doHttpCall(String uri, HTTP_METHOD_TYPE type, Map<String, Object> data, NameValuePair[] params) throws IOException {
    HttpClient client = new HttpClient();
    HttpMethod method;
    switch (type) {
    case GET:
      method = new GetMethod(uri);
      break;
    case DELETE:
      method = new DeleteMethod(uri);
      break;
    case PUT:
      method = new PutMethod(uri);
      if(data == null) {
        break;
      }
      String msgBody = JsonBuilder.mapToJson(data);
      LOG.info("Msg Body: " + msgBody);
      StringRequestEntity sre = new StringRequestEntity(msgBody, "application/json", charSet);
      ((PutMethod)method).setRequestEntity(sre);
      break;
    default:
      throw new IllegalArgumentException("Unsupported method type: " + type);
    }
    if(params == null) {
      method.setQueryString(new NameValuePair[] {new NameValuePair("user.name", username)});
    }
    else {
      NameValuePair[] newParams = new NameValuePair[params.length + 1];
      System.arraycopy(params, 0, newParams, 1, params.length);
      newParams[0] = new NameValuePair("user.name", username);
      method.setQueryString(newParams);
    }
    String actualUri = "no URI";
    try {
      actualUri = method.getURI().toString();//should this be escaped string?
      LOG.debug(type + ": " + method.getURI().getEscapedURI());
      int httpStatus = client.executeMethod(method);
      LOG.debug("Http Status Code=" + httpStatus);
      String resp = method.getResponseBodyAsString();
      LOG.debug("response: " + resp);
      return new MethodCallRetVal(httpStatus, resp, actualUri, method.getName());
    }
    catch (IOException ex) {
      LOG.error("doHttpCall() failed", ex);
    }
    finally {
      method.releaseConnection();
    }
    return new MethodCallRetVal(-1, "Http " + type + " failed; see log file for details", actualUri, method.getName());
  }
Does a basic HTTP GET and returns Http Status code + response body
Will add the dummy user query string
hcatalog/webhcat/svr/src/test/java/org/apache/hive/hcatalog/templeton/TestWebHCatE2e.java