public static URI createURI(String baseUrl, String path, String... queryParams) {
    UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(baseUrl).path(path);

    if (queryParams != null) {
      if (queryParams.length % 2 != 0) {
        throw new IllegalArgumentException("invalid queryParams count");
      }
      for (int i = 0; i < queryParams.length; i += 2) {
        builder.queryParam(queryParams[i], queryParams[i + 1]);
      }
    }
    return builder.build().encode().toUri();
  }
build the url using the path and query params

@param path : the part after the baseUrl
@param queryParams this needs to be an even number of strings in the form of paramName,
       paramValue....
geode-gfsh/src/main/java/org/apache/geode/management/internal/web/http/support/HttpRequester.java