public UriBuilder getUriBuilder(MultivaluedMapImpl data, StringBuilder curlBuilder) {
    MultivaluedMapImpl effectiveData;
    if (data == null)
      effectiveData = new MultivaluedMapImpl();
    else
      effectiveData = new MultivaluedMapImpl(data);

    effectiveData.putSingle("user.name", username);
    effectiveData.putSingle("doAs", doAs);

    UriBuilder builder = UriBuilder.fromPath("host/");
    for(String key : effectiveData.keySet()) {
      for(String value : effectiveData.get(key)) {
        builder.queryParam(key, value);
        curlBuilder.append(String.format("-d %s=\"%s\" ", key, value.replace("\"", "\\\"")));
      }
    }

    if (data != null)
      LOG.debug("data: {}", builder.build().getRawQuery());
    return builder;
  }
Main implementation of PUT request
@param resource resource
@param data put body
@return unmarshalled response data
contrib/views/pig/src/main/java/org/apache/ambari/view/pig/templeton/client/JSONRequest.java